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 {createSandbox} = require("./_common"); | 20 const {createSandbox} = require("./_common"); |
21 | 21 |
22 let Subscription = null; | 22 let Subscription = null; |
23 let SpecialSubscription = null; | 23 let SpecialSubscription = null; |
24 let DownloadableSubscription = null; | 24 let DownloadableSubscription = null; |
25 let RegularSubscription = null; | 25 let RegularSubscription = null; |
26 let ExternalSubscription = null; | 26 let ExternalSubscription = null; |
27 | 27 |
28 exports.setUp = function(callback) | 28 exports.setUp = function(callback) |
29 { | 29 { |
30 let sandboxedRequire = createSandbox(); | 30 let sandboxedRequire = createSandbox(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 test.equal(typeof ExternalSubscription, "function", "typeof ExternalSubscripti
on"); | 65 test.equal(typeof ExternalSubscription, "function", "typeof ExternalSubscripti
on"); |
66 test.equal(typeof DownloadableSubscription, "function", "typeof DownloadableSu
bscription"); | 66 test.equal(typeof DownloadableSubscription, "function", "typeof DownloadableSu
bscription"); |
67 | 67 |
68 test.done(); | 68 test.done(); |
69 }; | 69 }; |
70 | 70 |
71 exports.testSubscriptionsWithState = function(test) | 71 exports.testSubscriptionsWithState = function(test) |
72 { | 72 { |
73 compareSubscription(test, "~fl~", ["url=~fl~"]); | 73 compareSubscription(test, "~fl~", ["url=~fl~"]); |
74 compareSubscription(test, "http://test/default", ["url=http://test/default", "
title=http://test/default"]); | 74 compareSubscription(test, "http://test/default", ["url=http://test/default", "
title=http://test/default"]); |
75 compareSubscription(test, "http://test/default_titled", ["url=http://test/defa
ult_titled", "title=test"], function(subscription) | 75 compareSubscription( |
76 { | 76 test, "http://test/default_titled", ["url=http://test/default_titled", "titl
e=test"], |
77 subscription.title = "test"; | 77 subscription => |
78 }); | 78 { |
79 compareSubscription(test, "http://test/non_default", ["url=http://test/non_def
ault", "title=test", | 79 subscription.title = "test"; |
80 "disabled=true", "lastSuccess=
8", "lastDownload=12", "lastCheck=16", "softExpiration=18", "expires=20", "downl
oadStatus=foo", | 80 } |
81 "errors=3", "version=24", "req
uiredVersion=0.6"], function(subscription) | 81 ); |
82 { | 82 compareSubscription( |
83 subscription.title = "test"; | 83 test, "http://test/non_default", |
84 subscription.disabled = true; | 84 ["url=http://test/non_default", "title=test", "disabled=true", |
85 subscription.lastSuccess = 8; | 85 "lastSuccess=8", "lastDownload=12", "lastCheck=16", "softExpiration=18", |
86 subscription.lastDownload = 12; | 86 "expires=20", "downloadStatus=foo", "errors=3", "version=24", |
87 subscription.lastCheck = 16; | 87 "requiredVersion=0.6"], |
88 subscription.softExpiration = 18; | 88 subscription => |
89 subscription.expires = 20; | 89 { |
90 subscription.downloadStatus = "foo"; | 90 subscription.title = "test"; |
91 subscription.errors = 3; | 91 subscription.disabled = true; |
92 subscription.version = 24; | 92 subscription.lastSuccess = 8; |
93 subscription.requiredVersion = "0.6"; | 93 subscription.lastDownload = 12; |
94 }); | 94 subscription.lastCheck = 16; |
95 compareSubscription(test, "~wl~", ["url=~wl~", "disabled=true", "title=Test gr
oup"], function(subscription) | 95 subscription.softExpiration = 18; |
96 { | 96 subscription.expires = 20; |
97 subscription.title = "Test group"; | 97 subscription.downloadStatus = "foo"; |
98 subscription.disabled = true; | 98 subscription.errors = 3; |
99 }); | 99 subscription.version = 24; |
| 100 subscription.requiredVersion = "0.6"; |
| 101 } |
| 102 ); |
| 103 compareSubscription( |
| 104 test, "~wl~", ["url=~wl~", "disabled=true", "title=Test group"], |
| 105 subscription => |
| 106 { |
| 107 subscription.title = "Test group"; |
| 108 subscription.disabled = true; |
| 109 } |
| 110 ); |
100 | 111 |
101 test.done(); | 112 test.done(); |
102 }; | 113 }; |
OLD | NEW |