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

Side by Side Diff: test/filterStorage.js

Issue 29870577: Issue 6916 - Encapsulate filter subscriptions (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Add subscriptionCount property Created Sept. 1, 2018, 2:16 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/filterListener.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 function compareFiltersList(test, testMessage, list) 73 function compareFiltersList(test, testMessage, list)
74 { 74 {
75 let result = FilterStorage.subscriptions.map( 75 let result = FilterStorage.subscriptions.map(
76 subscription => subscription.filters.map( 76 subscription => subscription.filters.map(
77 filter => filter.text)); 77 filter => filter.text));
78 test.deepEqual(result, list, testMessage); 78 test.deepEqual(result, list, testMessage);
79 } 79 }
80 80
81 function compareFilterSubscriptions(test, testMessage, filter, list) 81 function compareFilterSubscriptions(test, testMessage, filter, list)
82 { 82 {
83 let result = [...filter.subscriptions].map(subscription => subscription.url); 83 let result = [...filter.subscriptions()].map(subscription => subscription.url) ;
84 let expected = list.map(subscription => subscription.url); 84 let expected = list.map(subscription => subscription.url);
85 test.deepEqual(result, expected, testMessage); 85 test.deepEqual(result, expected, testMessage);
86 } 86 }
87 87
88 exports.testAddingSubscriptions = function(test) 88 exports.testAddingSubscriptions = function(test)
89 { 89 {
90 let subscription1 = Subscription.fromURL("http://test1/"); 90 let subscription1 = Subscription.fromURL("http://test1/");
91 let subscription2 = Subscription.fromURL("http://test2/"); 91 let subscription2 = Subscription.fromURL("http://test2/");
92 92
93 let changes = []; 93 let changes = [];
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 compareFilterSubscriptions(test, "filter3 subscriptions after updating http:// test3/ filters", filter3, [subscription2]); 531 compareFilterSubscriptions(test, "filter3 subscriptions after updating http:// test3/ filters", filter3, [subscription2]);
532 532
533 FilterStorage.removeSubscription(subscription3); 533 FilterStorage.removeSubscription(subscription3);
534 534
535 compareFilterSubscriptions(test, "filter1 subscriptions after removing http:// test3/", filter1, []); 535 compareFilterSubscriptions(test, "filter1 subscriptions after removing http:// test3/", filter1, []);
536 compareFilterSubscriptions(test, "filter2 subscriptions after removing http:// test3/", filter2, [subscription2]); 536 compareFilterSubscriptions(test, "filter2 subscriptions after removing http:// test3/", filter2, [subscription2]);
537 compareFilterSubscriptions(test, "filter3 subscriptions after removing http:// test3/", filter3, [subscription2]); 537 compareFilterSubscriptions(test, "filter3 subscriptions after removing http:// test3/", filter3, [subscription2]);
538 538
539 test.done(); 539 test.done();
540 }; 540 };
OLDNEW
« no previous file with comments | « test/filterListener.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld