-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
550faca
commit 97511ba
Showing
4 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict' | ||
|
||
const assert = require('node:assert/strict') | ||
const { test } = require('node:test') | ||
const { RefResolver } = require('../index.js') | ||
|
||
test('should return true if schema exists', () => { | ||
const refResolver = new RefResolver() | ||
|
||
const schemaId = 'schemaId' | ||
const schema = { | ||
$id: 'schemaId', | ||
type: 'object', | ||
properties: { | ||
foo: { type: 'string' } | ||
} | ||
} | ||
refResolver.addSchema(schema) | ||
|
||
const hasSchema = refResolver.hasSchema(schemaId) | ||
assert.strictEqual(hasSchema, true) | ||
}) | ||
|
||
test('should return false if schema does not exist', () => { | ||
const refResolver = new RefResolver() | ||
const hasSchema = refResolver.hasSchema('schemaId') | ||
assert.strictEqual(hasSchema, false) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters