Skip to content

Commit

Permalink
fix google-ima3 conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka committed Dec 21, 2022
1 parent 5e990c4 commit 2538a5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/helpers/compatibility-redirects.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const redirects = [
},
{
adg: 'google-ima3',
ubo: 'google-ima.js',
},
{
adg: 'gemius',
Expand Down
8 changes: 8 additions & 0 deletions tests/lib-tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ test('Test REDIRECT converting - UBO -> ADG', (assert) => {
uboRule = '||g9g.eu^*fa.js$script,redirect=fuckadblock.js-3.2.0';
expectedAdgRule = '||g9g.eu^*fa.js$script,redirect=prevent-fab-3.2.0';
assert.strictEqual(convertRedirectToAdg(uboRule), expectedAdgRule);

uboRule = '||imasdk.googleapis.com/js/sdkloader/ima3.js$script,important,redirect=google-ima.js,domain=example.org';
expectedAdgRule = '||imasdk.googleapis.com/js/sdkloader/ima3.js$script,important,redirect=google-ima3,domain=example.org';
assert.strictEqual(convertRedirectToAdg(uboRule), expectedAdgRule);
});

test('Test REDIRECT-RULE converting - UBO -> ADG', (assert) => {
Expand Down Expand Up @@ -555,6 +559,10 @@ test('Test REDIRECT converting - ADG -> UBO', (assert) => {
new RegExp('Unable to convert for uBO'), // specific error matcher
'no TYPES to specify, ABSENT_SOURCE_TYPE_REPLACEMENT should be updated',
);

adgRule = '||imasdk.googleapis.com/js/sdkloader/ima3.js$script,important,redirect=google-ima3,domain=example.org';
expectedUboRule = '||imasdk.googleapis.com/js/sdkloader/ima3.js$script,important,redirect=google-ima.js,domain=example.org';
assert.strictEqual(convertAdgRedirectToUbo(adgRule), expectedUboRule);
});

test('Test REDIRECT-RULE converting - ADG -> UBO', (assert) => {
Expand Down

0 comments on commit 2538a5b

Please sign in to comment.