/
test.js
33 lines (28 loc) · 887 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
'use strict'
var test = require('tape')
var isSecret = require('./')
test('isSecret.key true', function (t) {
t.equal(isSecret.key('pass'), true)
t.equal(isSecret.key('password'), true)
t.equal(isSecret.key('api-key'), true)
t.equal(isSecret.key('api.key'), true)
t.equal(isSecret.key('api_key'), true)
t.equal(isSecret.key('apikey'), true)
t.end()
})
test('isSecret.key false', function (t) {
t.equal(isSecret.key('passport'), false)
t.equal(isSecret.key('copenhagen'), false)
t.equal(isSecret.key('api*key'), false)
t.end()
})
test('isSecret.value credt card number', function (t) {
t.equal(isSecret.value('1234 1234 1234 1234'), true)
t.equal(isSecret.value('1234-1234-1234-1234'), true)
t.equal(isSecret.value('1234123412341234'), true)
t.end()
})
test('isSecret.value false', function (t) {
t.equal(isSecret.value('foobar'), false)
t.end()
})