-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathtest.js
58 lines (41 loc) · 1.29 KB
/
test.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
'use strict';
var assert = require('assert');
var emojiFlags = require('./');
describe('getter methods', function(){
it('data', function() {
assert.equal(emojiFlags.data.length, 251);
assert.equal(emojiFlags.data[2].name, 'Afghanistan');
});
it('emojis', function() {
assert.equal(emojiFlags.emojis.length, 251);
assert.equal(emojiFlags.emojis[77], '🇬🇧');
});
it('codes', function() {
assert.equal(emojiFlags.codes.length, 251);
assert.equal(emojiFlags.codes[201], 'SJ');
});
it('names', function() {
assert.equal(emojiFlags.names.length, 251);
assert.equal(emojiFlags.names[151], 'Mauritania');
});
it('unicodes', function() {
assert.equal(emojiFlags.unicodes.length, 251);
assert.equal(emojiFlags.unicodes[102], 'U+1F1EE U+1F1EA');
});
it('country code getters', function() {
assert(emojiFlags.DK);
assert.equal(emojiFlags.DK.emoji, '🇩🇰');
});
});
describe('getter methods', function(){
it('should handle no country code passed', function() {
assert.throws(function() {
emojiFlags.countryCode();
}, /Expected/);
});
it('should return country object', function() {
var result = emojiFlags.countryCode('dk');
assert.equal(result.code, 'DK');
assert.equal(result.emoji, '🇩🇰');
});
});