Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka committed Jul 11, 2024
1 parent 68b014d commit e67fb0b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/test/builder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,16 @@ describe('Test builder', () => {
expect(elseLines.includes('ios_rule')).toBeFalsy();
expect(elseLines.includes('non_ios_rule')).toBeTruthy();
});

it('filters4.txt - adguard_ext_chromium_mv3 constant for the if directive', async () => {
const ifContent = await readFile(path.join(platformsDir, 'chromium-mv3', 'filters', '4.txt'));
expect(ifContent).toBeTruthy();

const ifLines = ifContent.split(/\r?\n/);
expect(ifLines.length).toEqual(23);
expect(ifLines.includes('chrome_mv3_specific_rule')).toBeTruthy();
expect(ifLines.includes('ios_rule')).toBeFalsy();
});
});

describe('platformsIncluded directive', () => {
Expand Down
8 changes: 7 additions & 1 deletion src/test/resources/filters/filter_4_Directives/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@
"subscriptionUrl": "https://example.com/",
"tags": [],
"trustLevel": "full",
"platformsIncluded": ["mac", "ios", "ext_ublock", "ext_edge"]
"platformsIncluded": [
"mac",
"ios",
"ext_ublock",
"ext_edge",
"ext_chromium_mv3"
]
}
3 changes: 3 additions & 0 deletions src/test/resources/filters/filter_4_Directives/template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
!#if (!ublock)
if_not_ublock
!#endif
!#if (adguard_ext_chromium_mv3)
chrome_mv3_specific_rule
!#endif
!#if (adguard_ext_chromium && adguard_ext_edge)
if_edge_chromium
!#endif
Expand Down
12 changes: 12 additions & 0 deletions src/test/resources/platforms.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@
"adguard_ext_chromium": true
}
},
"EXTENSION_CHROMIUM_MV3": {
"platform": "ext_chromium_mv3",
"path": "chromium-mv3",
"configuration": {
"removeRulePatterns": false,
"ignoreRuleHints": false
},
"defines": {
"adguard": true,
"adguard_ext_chromium_mv3": true
}
},
"EXTENSION_EDGE": {
"platform": "ext_edge",
"path": "edge",
Expand Down

0 comments on commit e67fb0b

Please sign in to comment.