-
Notifications
You must be signed in to change notification settings - Fork 36
/
date.js
53 lines (46 loc) · 864 Bytes
/
date.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
if (typeof module !== 'undefined' && module.exports) {
var expect = require('expect.js');
var Amanda = require('../../../../dist/latest.js');
}
/**
* Format
* --------------------
*/
suite('JSON/Attribute/format#date', function() {
var count = 0;
/**
* Schema
*/
var schema = {
format: 'date'
};
/**
* Validator
*/
var Validator = new Amanda('json');
test('should return an error', function() {
[
0,
1,
2,
'123',
'+@#$~^*{}',
'lorem ipsum',
' ',
123,
null,
[],
{},
function() {},
null
].forEach(function(data) {
Validator.validate(data, schema, function(error) {
count += 1;
expect(error).to.be.ok();
});
});
});
test('should run 13 times', function() {
expect(count).to.be.eql(13);
});
});