Skip to content

Commit a88be61

Browse files
committed
tests: add more tests to feature
1 parent c01683b commit a88be61

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

test/unit/features.test.js

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
var proxyquire = require('proxyquire');
22
var test = require('tap').test;
3-
var features = proxyquire('../../lib/features', {
4-
'./config': {
5-
security: {
6-
embedWhiteList: ['https://foo.com']
7-
}
8-
}
9-
});
103

114
test('whitelist works', function (t) {
5+
var features = proxyquire('../../lib/features', {
6+
'./config': {
7+
security: {
8+
embedWhiteList: ['https://foo.com']
9+
}
10+
}
11+
});
12+
1213
var req = {
1314
headers: {
1415
referrer: 'https://foo.com'
@@ -35,3 +36,26 @@ test('whitelist works', function (t) {
3536

3637
t.end();
3738
});
39+
40+
41+
test('whitelist does not bail when empty', function (t) {
42+
var features = proxyquire('../../lib/features', {
43+
'./config': {
44+
security: {}
45+
}
46+
});
47+
48+
var req = {
49+
headers: {
50+
referrer: 'https://foo.com'
51+
},
52+
get: function (key) {
53+
return req.headers[key.toLowerCase()];
54+
}
55+
};
56+
57+
var res = features('sslForEmbeds', req);
58+
t.equal(res, false, 'foo.com disallowed');
59+
60+
t.end();
61+
});

0 commit comments

Comments
 (0)