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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 if (lines.length && lines[lines.length - 1] == "") | 163 if (lines.length && lines[lines.length - 1] == "") |
164 lines.pop(); | 164 lines.pop(); |
165 | 165 |
166 let importer = FilterStorage.importData(); | 166 let importer = FilterStorage.importData(); |
167 for (let line of lines) | 167 for (let line of lines) |
168 importer(line); | 168 importer(line); |
169 importer(null); | 169 importer(null); |
170 | 170 |
171 test.equal(FilterStorage.fileProperties.version, FilterStorage.formatVersion
, "File format version"); | 171 test.equal(FilterStorage.fileProperties.version, FilterStorage.formatVersion
, "File format version"); |
172 | 172 |
173 let exported = Array.from(FilterStorage.exportData()); | 173 let exported = [...FilterStorage.exportData()]; |
174 test.deepEqual(canonize(exported), canonize(lines), "Import/export result"); | 174 test.deepEqual(canonize(exported), canonize(lines), "Import/export result"); |
175 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 175 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
176 }; | 176 }; |
177 | 177 |
178 exports.testSavingWithoutBackups = function(test) | 178 exports.testSavingWithoutBackups = function(test) |
179 { | 179 { |
180 Prefs.patternsbackups = 0; | 180 Prefs.patternsbackups = 0; |
181 Prefs.patternsbackupinterval = 24; | 181 Prefs.patternsbackupinterval = 24; |
182 | 182 |
183 FilterStorage.saveToDisk().then(() => | 183 FilterStorage.saveToDisk().then(() => |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 return FilterStorage.restoreBackup(1); | 263 return FilterStorage.restoreBackup(1); |
264 }).then(() => | 264 }).then(() => |
265 { | 265 { |
266 test.equal([...FilterStorage.subscriptions()][0].filters.length, 1, "Filter
count after restoring backup"); | 266 test.equal([...FilterStorage.subscriptions()][0].filters.length, 1, "Filter
count after restoring backup"); |
267 return FilterStorage.loadFromDisk(); | 267 return FilterStorage.loadFromDisk(); |
268 }).then(() => | 268 }).then(() => |
269 { | 269 { |
270 test.equal([...FilterStorage.subscriptions()][0].filters.length, 1, "Filter
count after reloading"); | 270 test.equal([...FilterStorage.subscriptions()][0].filters.length, 1, "Filter
count after reloading"); |
271 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 271 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
272 }; | 272 }; |
OLD | NEW |