UNPKG

@eluvio/elv-js-helpers

Version:

A collection of Javascript helper functions used by several Eluvio libraries.

12 lines (10 loc) 504 B
const TH = require('../../../test-helpers') const PositiveIntModel = TH.requireSrcFile('Model/PositiveIntModel') describe('PositiveIntModel', () => { it('should work as expected', () => { PositiveIntModel(42).should.equal(42) TH.expect(() => PositiveIntModel(0)).to.throw('Value must be > 0 (got: 0)') TH.expect(() => PositiveIntModel(4.2)).to.throw('Value must be an integer (got: 4.2)') TH.expect(() => PositiveIntModel('foo')).to.throw('expecting Number, got String "foo"') }) })