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

Unified Diff: test/filterStorage_readwrite.js

Issue 29934588: Issue 7094 - Encapsulate management of subscription filters (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Simplify patch Created Nov. 17, 2018, 9:25 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
Index: test/filterStorage_readwrite.js
===================================================================
--- a/test/filterStorage_readwrite.js
+++ b/test/filterStorage_readwrite.js
@@ -103,36 +103,37 @@
{
test.ok(filterStorage.initialized, "Initialize after the first load");
test.equal(filterStorage.fileProperties.version, filterStorage.formatVersion, "File format version");
if (withExternal)
{
{
let subscription = new ExternalSubscription("~external~external subscription ID", "External subscription");
- subscription.filters = [Filter.fromText("foo"), Filter.fromText("bar")];
+ subscription.addFilter(Filter.fromText("foo"));
+ subscription.addFilter(Filter.fromText("bar"));
filterStorage.addSubscription(subscription);
}
let externalSubscriptions = [...filterStorage.subscriptions()].filter(subscription => subscription instanceof ExternalSubscription);
test.equal(externalSubscriptions.length, 1, "Number of external subscriptions after updateExternalSubscription");
test.equal(externalSubscriptions[0].url, "~external~external subscription ID", "ID of external subscription");
- test.equal(externalSubscriptions[0].filters.length, 2, "Number of filters in external subscription");
+ test.equal(externalSubscriptions[0].filterCount, 2, "Number of filters in external subscription");
}
if (withEmptySpecial)
{
let specialSubscription =
SpecialSubscription.createForFilter(Filter.fromText("!foo"));
filterStorage.addSubscription(specialSubscription);
filterStorage.removeFilter(Filter.fromText("!foo"), specialSubscription);
- test.equal(specialSubscription.filters.length, 0,
+ test.equal(specialSubscription.filterCount, 0,
"No filters in special subscription");
test.ok(new Set(filterStorage.subscriptions()).has(specialSubscription),
"Empty special subscription still in storage");
}
return filterStorage.saveToDisk();
}).then(() => testData).then(expected =>
{
@@ -245,28 +246,28 @@
exports.testRestoringBackup = function(test)
{
Prefs.patternsbackups = 2;
Prefs.patternsbackupinterval = 24;
filterStorage.saveToDisk().then(() =>
{
- test.equal([...filterStorage.subscriptions()][0].filters.length, 1, "Initial filter count");
+ test.equal([...filterStorage.subscriptions()][0].filterCount, 1, "Initial filter count");
filterStorage.addFilter(Filter.fromText("barfoo"));
- test.equal([...filterStorage.subscriptions()][0].filters.length, 2, "Filter count after adding a filter");
+ test.equal([...filterStorage.subscriptions()][0].filterCount, 2, "Filter count after adding a filter");
return filterStorage.saveToDisk();
}).then(() =>
{
return filterStorage.loadFromDisk();
}).then(() =>
{
- test.equal([...filterStorage.subscriptions()][0].filters.length, 2, "Filter count after adding filter and reloading");
+ test.equal([...filterStorage.subscriptions()][0].filterCount, 2, "Filter count after adding filter and reloading");
return filterStorage.restoreBackup(1);
}).then(() =>
{
- test.equal([...filterStorage.subscriptions()][0].filters.length, 1, "Filter count after restoring backup");
+ test.equal([...filterStorage.subscriptions()][0].filterCount, 1, "Filter count after restoring backup");
return filterStorage.loadFromDisk();
}).then(() =>
{
- test.equal([...filterStorage.subscriptions()][0].filters.length, 1, "Filter count after reloading");
+ test.equal([...filterStorage.subscriptions()][0].filterCount, 1, "Filter count after reloading");
}).catch(unexpectedError.bind(test)).then(() => test.done());
};

Powered by Google App Engine
This is Rietveld