| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 "use strict"; | 18 "use strict"; |
| 19 | 19 |
| 20 const {createSandbox, maybeExpectError} = require("./_common"); | 20 const {createSandbox, silenceAssertionOutput} = require("./_common"); |
| 21 | 21 |
| 22 let Filter = null; | 22 let Filter = null; |
| 23 let FilterNotifier = null; | 23 let FilterNotifier = null; |
| 24 let FilterStorage = null; | 24 let FilterStorage = null; |
| 25 let Subscription = null; | 25 let Subscription = null; |
| 26 | 26 |
| 27 exports.setUp = function(callback) | 27 exports.setUp = function(callback) |
| 28 { | 28 { |
| 29 let sandboxedRequire = createSandbox(); | 29 let sandboxedRequire = createSandbox(); |
| 30 | 30 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 | 177 |
| 178 FilterStorage.removeSubscription(subscription2); | 178 FilterStorage.removeSubscription(subscription2); |
| 179 compareSubscriptionList(test, "Remove", [subscription3, subscription1]); | 179 compareSubscriptionList(test, "Remove", [subscription3, subscription1]); |
| 180 | 180 |
| 181 changes = []; | 181 changes = []; |
| 182 test.ok(FilterStorage.moveSubscription(subscription3, subscription2), "Move be fore removed subscription succeeded"); | 182 test.ok(FilterStorage.moveSubscription(subscription3, subscription2), "Move be fore removed subscription succeeded"); |
| 183 compareSubscriptionList(test, "Move before removed subscription", [subscriptio n1, subscription3]); | 183 compareSubscriptionList(test, "Move before removed subscription", [subscriptio n1, subscription3]); |
| 184 test.deepEqual(changes, ["subscription.moved http://test3/"], "Received change s"); | 184 test.deepEqual(changes, ["subscription.moved http://test3/"], "Received change s"); |
| 185 | 185 |
| 186 changes = []; | 186 changes = []; |
| 187 maybeExpectError( | 187 test.ok(!silenceAssertionOutput( |
| 188 "Attempt to move a subscription that is not in the list", | 188 () => FilterStorage.moveSubscription(subscription2), |
| 189 () => test.ok(!FilterStorage.moveSubscription(subscription2), "Move of remov ed subscription failed") | 189 "Attempt to move a subscription that is not in the list" |
|
sergei
2017/11/24 10:15:28
What about being more strict and wrap only the cal
hub
2017/11/24 15:48:59
Done.
| |
| 190 ); | 190 ), "Move of removed subscription failed"); |
| 191 compareSubscriptionList(test, "Move of removed subscription", [subscription1, subscription3]); | 191 compareSubscriptionList(test, "Move of removed subscription", [subscription1, subscription3]); |
| 192 test.deepEqual(changes, [], "Received changes"); | 192 test.deepEqual(changes, [], "Received changes"); |
| 193 | 193 |
| 194 subscription1.delete(); | 194 subscription1.delete(); |
| 195 subscription2.delete(); | 195 subscription2.delete(); |
| 196 subscription3.delete(); | 196 subscription3.delete(); |
| 197 | 197 |
| 198 test.done(); | 198 test.done(); |
| 199 }; | 199 }; |
| 200 | 200 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 "filter.removed foo 2 1" | 297 "filter.removed foo 2 1" |
| 298 ], "Received changes"); | 298 ], "Received changes"); |
| 299 | 299 |
| 300 changes = []; | 300 changes = []; |
| 301 removeFilter("foo"); | 301 removeFilter("foo"); |
| 302 compareFiltersList(test, "Removing unknown filter", [[], ["@@bar", "foo##bar", "foo#@#bar"], ["!foobar"]]); | 302 compareFiltersList(test, "Removing unknown filter", [[], ["@@bar", "foo##bar", "foo#@#bar"], ["!foobar"]]); |
| 303 test.deepEqual(changes, [], "Received changes"); | 303 test.deepEqual(changes, [], "Received changes"); |
| 304 | 304 |
| 305 test.done(); | 305 test.done(); |
| 306 }; | 306 }; |
| LEFT | RIGHT |