File tree Expand file tree Collapse file tree 1 file changed +31
-7
lines changed Expand file tree Collapse file tree 1 file changed +31
-7
lines changed Original file line number Diff line number Diff line change 1
1
var proxyquire = require ( 'proxyquire' ) ;
2
2
var test = require ( 'tap' ) . test ;
3
- var features = proxyquire ( '../../lib/features' , {
4
- './config' : {
5
- security : {
6
- embedWhiteList : [ 'https://foo.com' ]
7
- }
8
- }
9
- } ) ;
10
3
11
4
test ( 'whitelist works' , function ( t ) {
5
+ var features = proxyquire ( '../../lib/features' , {
6
+ './config' : {
7
+ security : {
8
+ embedWhiteList : [ 'https://foo.com' ]
9
+ }
10
+ }
11
+ } ) ;
12
+
12
13
var req = {
13
14
headers : {
14
15
referrer : 'https://foo.com'
@@ -35,3 +36,26 @@ test('whitelist works', function (t) {
35
36
36
37
t . end ( ) ;
37
38
} ) ;
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments