Skip to content

Commit 1dac2ba

Browse files
committed
Add tests for valid types
1 parent b1d45fa commit 1dac2ba

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/invalid_types.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,26 @@ test('invalid types', function(assert) {
2727
msg = 'invalid type inside complex schema';
2828
assert.throws(function() { convert(schema); }, /InvalidTypeError.*invalidtype/, msg);
2929
});
30+
31+
test('valid types', function(assert) {
32+
var types = ['integer', 'number', 'string', 'boolean', 'object', 'array'];
33+
34+
assert.plan(types.length);
35+
36+
types.forEach(function(type) {
37+
var schema, result, expected;
38+
39+
schema = {
40+
type: type
41+
};
42+
43+
result = convert(schema);
44+
45+
expected = {
46+
$schema: 'http://json-schema.org/draft-04/schema#',
47+
type: type,
48+
};
49+
50+
assert.deepEqual(result, expected, type + ' ok');
51+
});
52+
});

0 commit comments

Comments
 (0)