From 2538a5b788b36702033b382b6051553454fe836b Mon Sep 17 00:00:00 2001 From: Slava Leleka Date: Wed, 21 Dec 2022 21:01:25 +0200 Subject: [PATCH] fix google-ima3 conversion --- src/helpers/compatibility-redirects.js | 1 + tests/lib-tests/index.test.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/helpers/compatibility-redirects.js b/src/helpers/compatibility-redirects.js index abce2dc02..656702a2d 100644 --- a/src/helpers/compatibility-redirects.js +++ b/src/helpers/compatibility-redirects.js @@ -77,6 +77,7 @@ const redirects = [ }, { adg: 'google-ima3', + ubo: 'google-ima.js', }, { adg: 'gemius', diff --git a/tests/lib-tests/index.test.js b/tests/lib-tests/index.test.js index 0055d1251..5339c8d2c 100644 --- a/tests/lib-tests/index.test.js +++ b/tests/lib-tests/index.test.js @@ -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) => { @@ -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) => {