Skip to content

Commit

Permalink
Update tests.html
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxodin committed Mar 28, 2023
1 parent a71ac20 commit 793c7f9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@
<script type=module>
import {Schema} from '../schema.js';

describe('api', () => {

it('schema.validate()', () => {
const schema = new Schema({ type: 'number', minimum: 3});
chai.expect( schema.validate('s') ).to.be.equal(false);
});
it('schema.error()', () => {
const schema = new Schema({ type: 'integer', minimum: 3});
chai.expect( schema.error(3.3) ).to.be.an('string');
chai.expect( schema.error(3) ).to.be.equal(false);
});
it('schema.errors()', () => {
const schema = new Schema({ type: 'integer', minimum: 3});
chai.expect( [...schema.errors(2.5)].length ).to.be.equal(2);
chai.expect( [...schema.errors(3)].length ).to.be.equal(0);
});


});

describe('validate "type"', () => {

Expand Down

0 comments on commit 793c7f9

Please sign in to comment.