|
1 | 1 | /* eslint-disable max-len */ |
2 | 2 | import { |
3 | | - describe, it, expect, vi, |
| 3 | + describe, |
| 4 | + it, |
| 5 | + expect, |
| 6 | + vi, |
4 | 7 | } from 'vitest'; |
5 | 8 |
|
6 | 9 | import { |
7 | | - convertAdgToUbo, convertAbpToAdg, convertScriptletToAdg, |
| 10 | + convertAdgToUbo, |
| 11 | + convertAbpToAdg, |
| 12 | + convertScriptletToAdg, |
8 | 13 | } from '@adguard/scriptlets/converters'; |
9 | 14 |
|
10 | 15 | import { |
@@ -40,12 +45,11 @@ describe('converter', () => { |
40 | 45 | expect(c[0]).toBe('benchmark.pl#$##bannerDBB { height: 10px !important; }'); |
41 | 46 |
|
42 | 47 | // https://github.com/AdguardTeam/FiltersCompiler/issues/24 |
43 | | - // FIXME: uncomment and fix 2 following tests due to the issue mentioned above |
44 | | - // c = convertRulesToAdgSyntax(['720hd.club#?##all:style(margin-top: 0 !important)']); |
45 | | - // expect(c[0]).toBe('720hd.club#?$##all { margin-top: 0 !important }'); |
46 | | - // |
47 | | - // c = convertRulesToAdgSyntax(['720hd.club#@?##all:style(margin-top: 0 !important)']); |
48 | | - // expect(c[0]).toBe('720hd.club#@$?##all { margin-top: 0 !important }'); |
| 48 | + c = convertRulesToAdgSyntax(['720hd.club#?##all:style(margin-top: 0 !important)']); |
| 49 | + expect(c[0]).toBe('720hd.club#$##all { margin-top: 0 !important }'); |
| 50 | + |
| 51 | + c = convertRulesToAdgSyntax(['720hd.club#@?##all:style(margin-top: 0 !important)']); |
| 52 | + expect(c[0]).toBe('720hd.club#@$##all { margin-top: 0 !important }'); |
49 | 53 |
|
50 | 54 | // https://github.com/AdguardTeam/FiltersCompiler/issues/54 |
51 | 55 | c = convertRulesToAdgSyntax(['#####']); |
@@ -279,13 +283,12 @@ describe('converter', () => { |
279 | 283 | }); |
280 | 284 |
|
281 | 285 | it('scriptlets converter is working', () => { |
282 | | - // FIXME |
283 | | - // let actual = convertAdgToUbo('example.com#@#+js(nano-setInterval-booster.js, some.example, 1000)'); |
284 | | - // let expected = "example.com#@%#//scriptlet('ubo-nano-setInterval-booster.js', 'some.example', '1000')"; |
285 | | - // expect(actual[0]).toBe(expected); |
| 286 | + let actual = convertScriptletToAdg('example.com#@#+js(nano-setInterval-booster.js, some.example, 1000)'); |
| 287 | + let expected = "example.com#@%#//scriptlet('ubo-nano-setInterval-booster.js', 'some.example', '1000')"; |
| 288 | + expect(actual[0]).toBe(expected); |
286 | 289 |
|
287 | | - let actual = convertAdgToUbo('example.org#%#//scriptlet("ubo-abort-on-property-read.js", "alert")'); |
288 | | - let expected = 'example.org##+js(abort-on-property-read, alert)'; |
| 290 | + actual = convertAdgToUbo('example.org#%#//scriptlet("ubo-abort-on-property-read.js", "alert")'); |
| 291 | + expected = 'example.org##+js(abort-on-property-read, alert)'; |
289 | 292 | expect(actual).toBe(expected); |
290 | 293 |
|
291 | 294 | actual = convertAdgToUbo('example.org#%#//scriptlet("abort-on-property-write", "adblock.check")'); |
|
0 commit comments