Index: test/synchronizer.js |
=================================================================== |
--- a/test/synchronizer.js |
+++ b/test/synchronizer.js |
@@ -17,29 +17,27 @@ |
"use strict"; |
let { |
createSandbox, setupTimerAndXMLHttp, setupRandomResult, unexpectedError, Cr, |
MILLIS_IN_SECOND, MILLIS_IN_HOUR |
} = require("./_common"); |
-let Filter = null; |
let filterStorage = null; |
let Prefs = null; |
let Subscription = null; |
exports.setUp = function(callback) |
{ |
let globals = Object.assign({}, setupTimerAndXMLHttp.call(this), |
setupRandomResult.call(this)); |
let sandboxedRequire = createSandbox({globals}); |
( |
- {Filter} = sandboxedRequire("../lib/filterClasses"), |
{filterStorage} = sandboxedRequire("../lib/filterStorage"), |
{Prefs} = sandboxedRequire("./stub-modules/prefs"), |
{Subscription} = sandboxedRequire("../lib/subscriptionClasses"), |
sandboxedRequire("../lib/synchronizer") |
); |
callback(); |
}; |
@@ -138,26 +136,21 @@ |
this.runScheduledTasks(2).then(() => |
{ |
test.equal(subscription.downloadStatus, currentTest.downloadStatus, "Download status"); |
test.equal(subscription.requiredVersion, currentTest.requiredVersion, "Required version"); |
if (currentTest.downloadStatus == "synchronize_ok") |
{ |
- test.deepEqual(subscription.filters, [ |
- Filter.fromText("foo"), |
- Filter.fromText("!bar"), |
- Filter.fromText("@@bas"), |
- Filter.fromText("#bam") |
- ], "Resulting subscription filters"); |
+ test.deepEqual([...subscription.filterText()], ["foo", "!bar", "@@bas", "#bam"], "Resulting subscription filters"); |
Manish Jethani
2018/11/17 21:41:09
Note: No need to create filter object, we just com
|
} |
else |
{ |
- test.deepEqual(subscription.filters, [ |
+ test.deepEqual([...subscription.filterText()], [ |
], "Resulting subscription filters"); |
} |
}).catch(unexpectedError.bind(test)).then(() => test.done()); |
}; |
} |
exports.testsDisabledUpdates = function(test) |
{ |
@@ -302,17 +295,17 @@ |
this.registerHandler("/subscription", metadata => |
{ |
return [Cr.NS_OK, 200, "[Adblock]\n" + comment + "\nfoo\nbar"]; |
}); |
this.runScheduledTasks(2).then(() => |
{ |
check(test, subscription); |
- test.deepEqual(subscription.filters, [Filter.fromText("foo"), Filter.fromText("bar")], "Special comment not added to filters"); |
+ test.deepEqual([...subscription.filterText()], ["foo", "bar"], "Special comment not added to filters"); |
}).catch(unexpectedError.bind(test)).then(() => test.done()); |
}; |
} |
exports.testRedirects = function(test) |
{ |
let subscription = Subscription.fromURL("http://example.com/subscription"); |
filterStorage.addSubscription(subscription); |