-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for metaschema context support
- Loading branch information
1 parent
0ed4347
commit 817820e
Showing
5 changed files
with
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
({ | ||
Nomen: { domain: 'Nomen' }, | ||
}); |
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,3 @@ | ||
({ | ||
Nomen: { type: 'string' }, | ||
}); |
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,3 @@ | ||
({ | ||
Nomen: { domain: 'Nomen' }, | ||
}); |
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,3 @@ | ||
({ | ||
Nomen: { domain: 'Nomen' }, | ||
}); |
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,32 @@ | ||
'use strict'; | ||
|
||
const metaschema = require('metaschema'); | ||
const metatests = require('metatests'); | ||
|
||
const { options, config } = require('../lib/metaschema-config/config'); | ||
|
||
const { MetaschemaError, SchemaValidationError } = metaschema.errors; | ||
|
||
metatests.test('metaschema context error on duplicated domains', async test => { | ||
await test.rejects( | ||
metaschema.fs.load('test/fixtures/context/duplicate', options, config), | ||
new MetaschemaError([ | ||
new SchemaValidationError('duplicate', 'duplicateDomain', { | ||
type: 'domain', | ||
value: 'Nomen', | ||
}), | ||
]) | ||
); | ||
}); | ||
|
||
metatests.test('metaschema context error on unresolved domain', async test => { | ||
await test.rejects( | ||
metaschema.fs.load('test/fixtures/context/unresolved', options, config), | ||
new MetaschemaError([ | ||
new SchemaValidationError('unresolved', 'context.Nomen', { | ||
type: 'domain', | ||
value: 'Nomen', | ||
}), | ||
]) | ||
); | ||
}); |