Skip to content

Commit

Permalink
test: more (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Sep 26, 2019
1 parent d2f11d6 commit 5dfd318
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/api.test.js
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);
});
});

0 comments on commit 5dfd318

Please sign in to comment.