-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
d2f11d6
commit 5dfd318
Showing
1 changed file
with
26 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 |
---|---|---|
@@ -1,8 +1,34 @@ | ||
import schemaUtils from '../src/index'; | ||
|
||
import schema from './fixtures/schema.json'; | ||
|
||
describe('api', () => { | ||
it('should export validate and ValidateError', () => { | ||
expect(typeof schemaUtils).toBe('function'); | ||
expect(typeof schemaUtils.ValidateError).toBe('function'); | ||
}); | ||
|
||
it('should work', () => { | ||
schemaUtils(schema, { minimumWithTypeNumber: 5 }); | ||
}); | ||
|
||
it('should work when options will be changed', () => { | ||
expect.assertions(1); | ||
|
||
const options = { minimumWithTypeNumber: 5 }; | ||
|
||
schemaUtils(schema, options); | ||
|
||
options.minimumWithTypeNumber = 1; | ||
|
||
try { | ||
schemaUtils(schema, options); | ||
} catch (error) { | ||
expect(error).toBeDefined(); | ||
} | ||
|
||
options.minimumWithTypeNumber = 120; | ||
|
||
schemaUtils(schema, options); | ||
}); | ||
}); |