| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 return filterStorage.loadFromDisk(); | 101 return filterStorage.loadFromDisk(); |
| 102 }).then(() => | 102 }).then(() => |
| 103 { | 103 { |
| 104 test.ok(filterStorage.initialized, "Initialize after the first load"); | 104 test.ok(filterStorage.initialized, "Initialize after the first load"); |
| 105 test.equal(filterStorage.fileProperties.version, filterStorage.formatVersion
, "File format version"); | 105 test.equal(filterStorage.fileProperties.version, filterStorage.formatVersion
, "File format version"); |
| 106 | 106 |
| 107 if (withExternal) | 107 if (withExternal) |
| 108 { | 108 { |
| 109 { | 109 { |
| 110 let subscription = new ExternalSubscription("~external~external subscrip
tion ID", "External subscription"); | 110 let subscription = new ExternalSubscription("~external~external subscrip
tion ID", "External subscription"); |
| 111 subscription.filters = [Filter.fromText("foo"), Filter.fromText("bar")]; | 111 subscription.filters = ["foo", "bar"]; |
| 112 filterStorage.addSubscription(subscription); | 112 filterStorage.addSubscription(subscription); |
| 113 } | 113 } |
| 114 | 114 |
| 115 let externalSubscriptions = [...filterStorage.subscriptions()].filter(subs
cription => subscription instanceof ExternalSubscription); | 115 let externalSubscriptions = [...filterStorage.subscriptions()].filter(subs
cription => subscription instanceof ExternalSubscription); |
| 116 test.equal(externalSubscriptions.length, 1, "Number of external subscripti
ons after updateExternalSubscription"); | 116 test.equal(externalSubscriptions.length, 1, "Number of external subscripti
ons after updateExternalSubscription"); |
| 117 | 117 |
| 118 test.equal(externalSubscriptions[0].url, "~external~external subscription
ID", "ID of external subscription"); | 118 test.equal(externalSubscriptions[0].url, "~external~external subscription
ID", "ID of external subscription"); |
| 119 test.equal(externalSubscriptions[0].filters.length, 2, "Number of filters
in external subscription"); | 119 test.equal(externalSubscriptions[0].filters.length, 2, "Number of filters
in external subscription"); |
| 120 } | 120 } |
| 121 | 121 |
| (...skipping 141 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 |