-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
45 lines (32 loc) · 954 Bytes
/
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
const test = require('tap').test
const countryRegex = require('./')
test('should not contain any blank props', function (t) {
var keys = Object.keys(countryRegex)
t.plan(keys.length)
keys.forEach(function (k) {
t.equal(typeof k, 'string')
})
})
test('should contain only three-letter uppercase props', function (t) {
var keys = Object.keys(countryRegex)
t.plan(keys.length * 2)
keys.forEach(function (k) {
t.equal(k.length, 3)
t.equal(k.toUpperCase(), k)
})
})
test('should not contain any blank values', function (t) {
var keys = Object.keys(countryRegex)
t.plan(keys.length)
keys.forEach(function (k) {
t.equal(typeof countryRegex[k], 'string')
})
})
test('should contain only valid regex values', function (t) {
var keys = Object.keys(countryRegex)
t.plan(keys.length)
keys.forEach(function (k) {
var regex = new RegExp(countryRegex[k])
t.equal(typeof regex.test, 'function')
})
})