Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
mrijk committed Apr 15, 2017
1 parent 12b7679 commit b6da9f5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion lib/and.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const _ = require('lodash');

const testcheck = require('testcheck');
const tcg = testcheck.gen;

const {conform, invalidString} = require('./conform');
const {gen} = require('./gen');
Expand Down
7 changes: 5 additions & 2 deletions test/exercise.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const _ = require('lodash');

const {expect} = require('chai');;
Expand Down Expand Up @@ -31,4 +29,9 @@ describe('Test the exercise function', () => {
it('should generate 10 random values from a spec object', () => {
expect(s.exercise(s.nilable(isString))).to.have.length(10).to.satisfy(sample => _.every(sample, ([s]) => isNull(s) || isString(s)));
});

it('should throw an exception', () => {
s.def('::impossible', s.and(isInteger, isString));
expect(() => s.exercise('::impossible')).to.throw(Error, /sampleFromSpec failed.*/);
});
});
2 changes: 0 additions & 2 deletions test/gen.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const {expect} = require('chai')

const s = require('../lib/spec');
Expand Down

0 comments on commit b6da9f5

Please sign in to comment.