Skip to content

Commit 372c009

Browse files
committed
Test yellowlist additions getting cookieblocked.
1 parent b003df5 commit 372c009

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/tests/tests/yellowlist.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,34 @@
113113
});
114114
});
115115

116+
QUnit.test("Added domains get cookieblocked", (assert) => {
117+
const DOMAIN = "example.com";
118+
119+
let done = assert.async();
120+
assert.expect(2);
121+
122+
// mark domain for blocking
123+
badger.storage.setupHeuristicAction(DOMAIN, constants.BLOCK);
124+
125+
// respond with this domain added
126+
let ylist = get_ylist();
127+
ylist[DOMAIN] = true;
128+
server.respondWith("GET", constants.YELLOWLIST_URL,
129+
[200, {}, Object.keys(ylist).join("\n")]);
130+
131+
// update yellowlist
132+
badger.updateYellowlist(function (success) {
133+
assert.ok(success, "Callback status indicates success");
134+
135+
// check that the domain got cookieblocked
136+
assert.equal(
137+
badger.storage.getAction(DOMAIN),
138+
constants.COOKIEBLOCK,
139+
"domain is marked for blocking"
140+
);
141+
142+
done();
143+
});
144+
});
145+
116146
}());

0 commit comments

Comments
 (0)