Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: test/filterStorage_readwrite.js

Issue 30025555: Issue 6820 - Move tests to mocha (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Rebased. Created April 5, 2019, 4:16 p.m.
Right Patch Set: Rebased Created April 10, 2019, 6:33 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « test/filterStorage.js ('k') | test/matcher.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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
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 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld