jaywalk
Version:
Runtime type validation
23 lines • 858 B
JavaScript
;
var test = require('blue-tape');
var index_1 = require('../index');
test('utils', function (t) {
t.test('merge less specific type into more specific type', function (t) {
var schema = new index_1.Types.Intersection({
types: [
new index_1.Types.String({
minLength: 2
}),
new index_1.Types.Pattern({
pattern: '^[a-z]+$'
})
]
});
t.throws(function () { return index_1.assert(schema, 'HEY'); });
t.throws(function () { return index_1.assert(schema, '123'); });
t.doesNotThrow(function () { return index_1.assert(schema, 'a'); });
t.doesNotThrow(function () { return index_1.assert(schema, 'hey'); });
t.end();
});
});
//# sourceMappingURL=utils.spec.js.map