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-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 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 let importer = filterStorage.importData(); | 177 let importer = filterStorage.importData(); |
178 for (let line of lines) | 178 for (let line of lines) |
179 importer(line); | 179 importer(line); |
180 importer(null); | 180 importer(null); |
181 | 181 |
182 test.equal(filterStorage.fileProperties.version, filterStorage.formatVersion
, "File format version"); | 182 test.equal(filterStorage.fileProperties.version, filterStorage.formatVersion
, "File format version"); |
183 | 183 |
184 let exported = Array.from(filterStorage.exportData()); | 184 let exported = Array.from(filterStorage.exportData()); |
185 test.deepEqual(canonize(exported), canonize(lines), "Import/export result"); | 185 test.deepEqual(canonize(exported), canonize(lines), "Import/export result"); |
186 | |
187 // Make sure the relationships between filters and subscriptions are set | |
188 // up. | |
189 for (let subscription of filterStorage.subscriptions()) | |
190 { | |
191 for (let text of subscription.filterText()) | |
192 { | |
193 let found = false; | |
194 | |
195 for (let filterSubscription of Filter.fromText(text).subscriptions()) | |
196 { | |
197 if (filterSubscription == subscription) | |
198 { | |
199 found = true; | |
200 break; | |
201 } | |
202 } | |
203 | |
204 test.ok(found, `Filter ${text} should be linked to subscription ${subscr
iption.url}`); | |
205 } | |
206 } | |
207 } | 186 } |
208 catch (error) | 187 catch (error) |
209 { | 188 { |
210 unexpectedError.call(test, error); | 189 unexpectedError.call(test, error); |
211 } | 190 } |
212 | 191 |
213 test.done(); | 192 test.done(); |
214 }; | 193 }; |
215 | 194 |
216 exports.testSavingWithoutBackups = async function(test) | 195 exports.testSavingWithoutBackups = async function(test) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 293 |
315 test.equal([...filterStorage.subscriptions()][0].filterCount, 1, "Filter cou
nt after reloading"); | 294 test.equal([...filterStorage.subscriptions()][0].filterCount, 1, "Filter cou
nt after reloading"); |
316 } | 295 } |
317 catch (error) | 296 catch (error) |
318 { | 297 { |
319 unexpectedError.call(test, error); | 298 unexpectedError.call(test, error); |
320 } | 299 } |
321 | 300 |
322 test.done(); | 301 test.done(); |
323 }; | 302 }; |
OLD | NEW |