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

Unified Diff: test/snippets.js

Issue 29865583: Issue 6886 - Return snippet filters instead of just scripts (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: rename it getFiltersForDomain Created Aug. 27, 2018, 12:13 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/snippets.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/snippets.js
===================================================================
--- a/test/snippets.js
+++ b/test/snippets.js
@@ -43,18 +43,18 @@
function testScriptMatches(description, filters, domain, expectedMatches)
{
for (let filter of filters.map(Filter.fromText))
{
if (filter instanceof SnippetFilter)
Snippets.add(filter);
}
- let matches = Snippets.getScriptsForDomain(domain);
- test.deepEqual(matches.sort(), expectedMatches.sort(), description);
+ let matches = Snippets.getSnippetsForDomain(domain);
+ test.deepEqual(matches.map(elem => elem.script).sort(), expectedMatches.sort(), description);
Snippets.clear();
}
testScriptMatches(
"Ignore generic filters",
[
"#$#foo-1", "example.com#$#foo-2",
@@ -83,18 +83,17 @@
test.done();
};
exports.testSnippetFiltersContainer = function(test)
{
function compareRules(description, domain, expectedMatches)
{
- let result = Snippets.getScriptsForDomain(domain);
- expectedMatches = expectedMatches.map(filter => filter.script);
+ let result = Snippets.getSnippetsForDomain(domain);
test.deepEqual(result.sort(), expectedMatches.sort(), description);
}
let domainFilter = Filter.fromText("example.com#$#filter1");
let subdomainFilter = Filter.fromText("www.example.com#$#filter2");
let otherDomainFilter = Filter.fromText("other.example.com#$#filter3");
Snippets.add(domainFilter);
« no previous file with comments | « lib/snippets.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld