Permalink
Browse files

tests: add more tests to feature

  • Loading branch information...
1 parent c01683b commit a88be61da53db452e54572fe9d53f1e045d69be1 @remy remy committed Oct 27, 2016
Showing with 31 additions and 7 deletions.
  1. +31 −7 test/unit/features.test.js
@@ -1,14 +1,15 @@
var proxyquire = require('proxyquire');
var test = require('tap').test;
-var features = proxyquire('../../lib/features', {
- './config': {
- security: {
- embedWhiteList: ['https://foo.com']
- }
- }
-});
test('whitelist works', function (t) {
+ var features = proxyquire('../../lib/features', {
+ './config': {
+ security: {
+ embedWhiteList: ['https://foo.com']
+ }
+ }
+ });
+
var req = {
headers: {
referrer: 'https://foo.com'
@@ -35,3 +36,26 @@ test('whitelist works', function (t) {
t.end();
});
+
+
+test('whitelist does not bail when empty', function (t) {
+ var features = proxyquire('../../lib/features', {
+ './config': {
+ security: {}
+ }
+ });
+
+ var req = {
+ headers: {
+ referrer: 'https://foo.com'
+ },
+ get: function (key) {
+ return req.headers[key.toLowerCase()];
+ }
+ };
+
+ var res = features('sslForEmbeds', req);
+ t.equal(res, false, 'foo.com disallowed');
+
+ t.end();
+});

0 comments on commit a88be61

Please sign in to comment.