-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathspec.js
78 lines (64 loc) · 2.02 KB
/
spec.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
var assert = require('assert');
var hasKey = Object.prototype.hasOwnProperty;
testLocale('cs');
testLocale('da');
testLocale('de');
testLocale('en');
testLocale('es');
testLocale('fi');
testLocale('fr');
testLocale('nl');
testLocale('pt-br');
testLocale('ru');
testLocale('sk');
testLocale('sv');
testLocale('tr');
function testLocale(locale, path, name) {
path = path || ('./' + locale);
name = name || ('the `' + locale + '` module');
describe('requiring ' + name, function() {
var mod = require(path);
it('loads the `' + locale + '` locale', function() {
assert.equal(mod.__locale, locale);
});
it('exports the correct keys', function() {
assert(hasKey.call(mod, 'months'));
assert(hasKey.call(mod, 'abbreviated_months'));
assert(hasKey.call(mod, 'days'));
assert(hasKey.call(mod, 'abbreviated_days'));
assert(hasKey.call(mod, 'am'));
assert(hasKey.call(mod, 'pm'));
});
it('exports twelve month names as strings', function() {
assert.equal(mod.months.length, 12);
assert.equal(mod.abbreviated_months.length, 12);
mod.months.forEach(function(name) {
assert.equal(typeof name, "string");
});
mod.abbreviated_months.forEach(function(name) {
assert.equal(typeof name, "string");
});
});
it('exports seven day names as strings', function() {
assert.equal(mod.days.length, 7);
assert.equal(mod.abbreviated_days.length, 7);
mod.days.forEach(function(name) {
assert.equal(typeof name, "string");
assert(name.length);
});
mod.abbreviated_days.forEach(function(name) {
assert.equal(typeof name, "string");
assert(name.length);
});
});
it('exports an am value as string', function() {
assert.equal(typeof mod.am, "string");
assert(mod.am.length);
});
it('exports a pm value as string', function() {
assert.equal(typeof mod.pm, "string");
assert(mod.pm.length);
});
});
}
testLocale('en', './', 'the package main');