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 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 let importer = filterStorage.importData(); | 180 let importer = filterStorage.importData(); |
181 for (let line of lines) | 181 for (let line of lines) |
182 importer(line); | 182 importer(line); |
183 importer(null); | 183 importer(null); |
184 | 184 |
185 assert.equal(filterStorage.fileProperties.version, filterStorage.formatVer
sion, "File format version"); | 185 assert.equal(filterStorage.fileProperties.version, filterStorage.formatVer
sion, "File format version"); |
186 | 186 |
187 let exported = Array.from(filterStorage.exportData()); | 187 let exported = Array.from(filterStorage.exportData()); |
188 assert.deepEqual(canonize(exported), canonize(lines), "Import/export resul
t"); | 188 assert.deepEqual(canonize(exported), canonize(lines), "Import/export resul
t"); |
189 | |
190 // Make sure the relationships between filters and subscriptions are set | |
191 // up. | |
192 for (let subscription of filterStorage.subscriptions()) | |
193 { | |
194 for (let text of subscription.filterText()) | |
195 { | |
196 let found = false; | |
197 | |
198 for (let filterSubscription of Filter.fromText(text).subscriptions()) | |
199 { | |
200 if (filterSubscription == subscription) | |
201 { | |
202 found = true; | |
203 break; | |
204 } | |
205 } | |
206 | |
207 assert.ok(found, `Filter ${text} should be linked to subscription ${su
bscription.url}`); | |
208 } | |
209 } | |
210 } | 189 } |
211 catch (error) | 190 catch (error) |
212 { | 191 { |
213 unexpectedError.call(assert, error); | 192 unexpectedError.call(assert, error); |
214 } | 193 } |
215 }); | 194 }); |
216 | 195 |
217 describe("Backups", () => | 196 describe("Backups", () => |
218 { | 197 { |
219 it("Saving Without", async() => | 198 it("Saving Without", async() => |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 292 |
314 assert.equal([...filterStorage.subscriptions()][0].filterCount, 1, "Filt
er count after reloading"); | 293 assert.equal([...filterStorage.subscriptions()][0].filterCount, 1, "Filt
er count after reloading"); |
315 } | 294 } |
316 catch (error) | 295 catch (error) |
317 { | 296 { |
318 unexpectedError.call(assert, error); | 297 unexpectedError.call(assert, error); |
319 } | 298 } |
320 }); | 299 }); |
321 }); | 300 }); |
322 }); | 301 }); |
LEFT | RIGHT |