OLD | NEW |
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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 let { | 20 let {createSandbox} = require("./_common"); |
21 Subscription, SpecialSubscription, DownloadableSubscription, | 21 |
22 RegularSubscription, ExternalSubscription | 22 let Subscription = null; |
23 } = require("../lib/subscriptionClasses"); | 23 let SpecialSubscription = null; |
| 24 let DownloadableSubscription = null; |
| 25 let RegularSubscription = null; |
| 26 let ExternalSubscription = null; |
| 27 |
| 28 exports.setUp = function(callback) |
| 29 { |
| 30 let sandboxedRequire = createSandbox(); |
| 31 ( |
| 32 { |
| 33 Subscription, SpecialSubscription, DownloadableSubscription, |
| 34 RegularSubscription, ExternalSubscription |
| 35 } = sandboxedRequire("../lib/subscriptionClasses") |
| 36 ); |
| 37 callback(); |
| 38 }; |
24 | 39 |
25 function compareSubscription(test, url, expected, postInit) | 40 function compareSubscription(test, url, expected, postInit) |
26 { | 41 { |
27 expected.push("[Subscription]") | 42 expected.push("[Subscription]") |
28 let subscription = Subscription.fromURL(url); | 43 let subscription = Subscription.fromURL(url); |
29 if (postInit) | 44 if (postInit) |
30 postInit(subscription) | 45 postInit(subscription) |
31 let result = []; | 46 let result = []; |
32 subscription.serialize(result); | 47 subscription.serialize(result); |
33 test.equal(result.sort().join("\n"), expected.sort().join("\n"), url); | 48 test.equal(result.sort().join("\n"), expected.sort().join("\n"), url); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 subscription.requiredVersion = "0.6"; | 93 subscription.requiredVersion = "0.6"; |
79 }); | 94 }); |
80 compareSubscription(test, "~wl~", ["url=~wl~", "disabled=true", "title=Test gr
oup"], function(subscription) | 95 compareSubscription(test, "~wl~", ["url=~wl~", "disabled=true", "title=Test gr
oup"], function(subscription) |
81 { | 96 { |
82 subscription.title = "Test group"; | 97 subscription.title = "Test group"; |
83 subscription.disabled = true; | 98 subscription.disabled = true; |
84 }); | 99 }); |
85 | 100 |
86 test.done(); | 101 test.done(); |
87 }; | 102 }; |
OLD | NEW |