Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/filterStorage.js

Issue 29934588: Issue 7094 - Encapsulate management of subscription filters (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Nov. 2, 2018, 10:34 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/filterListener.js ('k') | test/filterStorage_readwrite.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/filterStorage.js
===================================================================
--- a/test/filterStorage.js
+++ b/test/filterStorage.js
@@ -67,18 +67,17 @@
test.deepEqual([...Subscription.knownSubscriptions.values()],
knownSubscriptions, testMessage);
}
}
function compareFiltersList(test, testMessage, list)
{
let result = [...filterStorage.subscriptions()].map(
- subscription => subscription.filters.map(
- filter => filter.text));
+ subscription => subscription.filters);
test.deepEqual(result, list, testMessage);
}
function compareFilterSubscriptions(test, testMessage, filter, list)
{
let result = [...filter.subscriptions()].map(subscription => subscription.url);
let expected = list.map(subscription => subscription.url);
test.deepEqual(result, expected, testMessage);
@@ -286,23 +285,23 @@
test.deepEqual(changes, ["filter.added !foobar"], "Received changes");
test.done();
};
exports.testRemovingFilters = function(test)
{
let subscription1 = Subscription.fromURL("~foo");
- subscription1.filters = [Filter.fromText("foo"), Filter.fromText("foo"), Filter.fromText("bar")];
+ subscription1.filters = ["foo", "foo", "bar"];
let subscription2 = Subscription.fromURL("~bar");
- subscription2.filters = [Filter.fromText("foo"), Filter.fromText("bar"), Filter.fromText("foo")];
+ subscription2.filters = ["foo", "bar", "foo"];
let subscription3 = Subscription.fromURL("http://test/");
- subscription3.filters = [Filter.fromText("foo"), Filter.fromText("bar")];
+ subscription3.filters = ["foo", "bar"];
filterStorage.addSubscription(subscription1);
filterStorage.addSubscription(subscription2);
filterStorage.addSubscription(subscription3);
let changes = [];
function listener(action, filter)
{
@@ -345,20 +344,20 @@
test.deepEqual(changes, [], "Received changes");
test.done();
};
exports.testMovingFilters = function(test)
{
let subscription1 = Subscription.fromURL("~foo");
- subscription1.filters = [Filter.fromText("foo"), Filter.fromText("bar"), Filter.fromText("bas"), Filter.fromText("foo")];
+ subscription1.filters = ["foo", "bar", "bas", "foo"];
let subscription2 = Subscription.fromURL("http://test/");
- subscription2.filters = [Filter.fromText("foo"), Filter.fromText("bar")];
+ subscription2.filters = ["foo", "bar"];
filterStorage.addSubscription(subscription1);
filterStorage.addSubscription(subscription2);
let changes = [];
function listener(action, filter)
{
if (action.indexOf("filter.") == 0)
@@ -446,23 +445,23 @@
exports.testFilterSubscriptionRelationship = function(test)
{
let filter1 = Filter.fromText("filter1");
let filter2 = Filter.fromText("filter2");
let filter3 = Filter.fromText("filter3");
let subscription1 = Subscription.fromURL("http://test1/");
- subscription1.filters = [filter1, filter2];
+ subscription1.filters = [filter1.text, filter2.text];
let subscription2 = Subscription.fromURL("http://test2/");
- subscription2.filters = [filter2, filter3];
+ subscription2.filters = [filter2.text, filter3.text];
let subscription3 = Subscription.fromURL("http://test3/");
- subscription3.filters = [filter1, filter2, filter3];
+ subscription3.filters = [filter1.text, filter2.text, filter3.text];
compareFilterSubscriptions(test, "Initial filter1 subscriptions", filter1, []);
compareFilterSubscriptions(test, "Initial filter2 subscriptions", filter2, []);
compareFilterSubscriptions(test, "Initial filter3 subscriptions", filter3, []);
filterStorage.addSubscription(subscription1);
compareFilterSubscriptions(test, "filter1 subscriptions after adding http://test1/", filter1, [subscription1]);
« no previous file with comments | « test/filterListener.js ('k') | test/filterStorage_readwrite.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld