Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka committed Nov 8, 2023
1 parent 521eea2 commit 7e79ca1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/test/converter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ describe('converter', () => {

c = converter.convertRulesToAdgSyntax([String.raw`||example.org/*/*/$replace=/<item type=\"banner\">.{280\,400}.*<\/background><\/item>//`]);
expect(c[0]).toBe(String.raw`||example.org/*/*/$replace=/<item type=\"banner\">.{280\,400}.*<\/background><\/item>//`);

c = converter.convertRulesToAdgSyntax(['||example.org^$permissions=geolocation=()']);
expect(c[0]).toBe('||example.org^$permissions=geolocation=()');
});

it('keeps cosmetic rule as is', () => {
Expand Down
9 changes: 9 additions & 0 deletions src/test/validator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,15 @@ describe('validator', () => {
});
});

describe('validate permissions modifier', () => {
const validRules = [
'||example.org^$permissions=geolocation=()',
];
test.each(validRules)('%s', (rule) => {
expect(validator.validate([rule])).toHaveLength(1);
});
});

it('checkAffinityDirectives test', () => {
let rules = [
'||test1.ru',
Expand Down

0 comments on commit 7e79ca1

Please sign in to comment.