Skip to content

Commit 7cdfd24

Browse files
committed
update unit tests
1 parent 2be43da commit 7cdfd24

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

__tests__/functions/json-validator.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,26 @@ test('processes a real world example when yaml_as_json is true and the single fi
424424
)
425425
})
426426

427+
test('processes a simple example and the single file contains no errors and uses the draft-04 ajv schema', async () => {
428+
process.env.INPUT_BASE_DIR = '__tests__/fixtures/json/valid'
429+
process.env.INPUT_JSON_SCHEMA_VERSION = 'draft-04'
430+
431+
expect(await jsonValidator(excludeMock)).toStrictEqual({
432+
failed: 0,
433+
passed: 1,
434+
skipped: 0,
435+
success: true,
436+
violations: []
437+
})
438+
439+
expect(debugMock).toHaveBeenCalledWith(
440+
'using ajv-formats with json-validator'
441+
)
442+
expect(debugMock).toHaveBeenCalledWith(
443+
'json - using baseDir: __tests__/fixtures/json/valid'
444+
)
445+
})
446+
427447
test('successfully validates json files with a schema when files is defined', async () => {
428448
const files = [
429449
'__tests__/fixtures/json/valid/json1.json',

0 commit comments

Comments
 (0)