Skip to content

Commit

Permalink
test: initial tests for linter mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ChALkeR committed Sep 8, 2023
1 parent 32ea1bd commit 3bfe91c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/lint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict'

const tape = require('tape')
const { lint } = require('../')

tape('lint mode', (t) => {
t.deepEqual(
lint({
$schema: 'https://json-schema.org/draft/2020-12/schema',
type: 'string',
format: 'date',
}),
[]
)
t.doesNotThrow(() => {
const schema = { type: 'string', format: 'date' }
t.deepEqual(lint(schema), [])
t.deepEqual(lint(schema, { mode: 'strong' }), [
{ message: '[requireSchema] $schema is required at #', keywordLocation: '#', schema },
])
})
t.end()
})

0 comments on commit 3bfe91c

Please sign in to comment.