Skip to content

Commit

Permalink
OSIS
Browse files Browse the repository at this point in the history
  • Loading branch information
NonlinearFruit committed Sep 3, 2023
1 parent 3aef1f3 commit 7dbfc20
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
14 changes: 11 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"devDependencies": {
"@vitest/coverage-c8": "^0.29.2",
"bible-passage-reference-parser": "^2.0.1"
"jsonschema": "^1.4.1",
"typescript": "^4.9.3",
"typescript-json-schema": "^0.55.0",
Expand Down
15 changes: 12 additions & 3 deletions tests/all.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { resolve } from "path";
import { readdirSync, readFileSync } from "fs"
import { Validator } from "jsonschema"
import TJS from "typescript-json-schema"
import type { CreedDocument, Proof } from "./types.ts"
import { bcv_parser as BcvParcer } from "bible-passage-reference-parser/js/en_bcv_parser"
import type { CreedDocument } from "./types.ts"

const repoPath = resolve(__dirname, '..')
const creedFolder = `${repoPath}/creeds`
Expand Down Expand Up @@ -34,6 +35,8 @@ const settings: TJS.PartialArgs = {
required: true,
}

const referenceParser = new BcvParcer()

const schemas = {}
for(const typeName of ["Metadata", "Proof", "Creed", "Canon", "Confession", "Catechism", "HenrysCatechism"])
schemas[typeName] = TJS.generateSchema(program, typeName, settings)
Expand Down Expand Up @@ -62,10 +65,16 @@ export const testDocument = (document: CreedDocument<any>, filename: string) =>
}

const testReferences = (proof: any) => {
for(const reference of proof.References)
test(`${reference} is valid`, async () => {
for(const reference of proof.References) {
test(`${reference} is a single reference`, async () => {
expect(reference).not.toContain(';')
})

test(`${reference} is OSIS`, async () => {
const osis = referenceParser.parse(reference).osis()
expect(reference).toEqual(osis)
})
}
}

export const testProofs = (item: any) => {
Expand Down

0 comments on commit 7dbfc20

Please sign in to comment.