Skip to content

Commit

Permalink
# validator
Browse files Browse the repository at this point in the history
Signed-off-by: Theo Truong <[email protected]>
  • Loading branch information
nhtruong committed May 21, 2024
1 parent db10cef commit 23d1ccc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"lint:spec": "ts-node tools/src/linter/lint.ts",
"lint": "eslint .",
"lint--fix": "eslint . --fix",
"test": "jest"
"test": "jest",
"test:spec": "ts-node tools/src/tester/test.ts"
},
"dependencies": {
"@apidevtools/swagger-parser": "^10.1.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/index_lifecycle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ prologues: []
epilogues:
- path: /books,movies,games
method: DELETE
ignore_errors: true
ignore_errors: false
chapters:
- synopsis: Create an index named `books` with mappings and settings.
path: /{index}
Expand Down
5 changes: 3 additions & 2 deletions tools/src/tester/ResultsDisplayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default class ResultsDisplayer {
display (): void {
this.#display_story()
this.#display_prologues()
this.#display_epilogues()
this.#display_chapters()
this.#display_epilogues()
}

#display_story (): void {
Expand All @@ -45,8 +45,9 @@ export default class ResultsDisplayer {
if (evaluations.some(e => e.result === Result.ERROR)) result = Result.ERROR
else if (evaluations.some(e => e.result === Result.FAILED)) result = Result.FAILED
else if (evaluations.every(e => e.result === Result.SKIPPED)) result = Result.SKIPPED
this.#display_evaluation({ result }, 'CHAPTERS', 3)

this.#display_evaluation({ result }, 'CHAPTERS', 3)
if (result === Result.PASSED) return
for (const evaluation of evaluations) {
this.#display_evaluation(evaluation, i(evaluation.synopsis), 6)
}
Expand Down
9 changes: 9 additions & 0 deletions tools/src/tester/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import OpenApiMerger from '../merger/OpenApiMerger'
import { LogLevel } from '../Logger'
import TestsRunner from './TestsRunner'

const spec = (new OpenApiMerger('./spec', LogLevel.error)).merge()
const runner = new TestsRunner(spec, './tests')
void runner.run().then(() => {
console.log('Tests run successfully.')
})

0 comments on commit 23d1ccc

Please sign in to comment.