From 85a738ce4962411d5a98895459047516c922e48d Mon Sep 17 00:00:00 2001 From: Ravi <7014230+arelra@users.noreply.github.com> Date: Thu, 19 Dec 2024 18:06:48 +0000 Subject: [PATCH] Delete libs jest mocks --- src/display/lazy-load.spec.ts | 4 ---- src/init/consented/prepare-googletag.spec.ts | 7 +++---- src/lib/__mocks__/config.js | 17 ----------------- 3 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 src/lib/__mocks__/config.js diff --git a/src/display/lazy-load.spec.ts b/src/display/lazy-load.spec.ts index 3e6a1f961..9996ec0b2 100644 --- a/src/display/lazy-load.spec.ts +++ b/src/display/lazy-load.spec.ts @@ -19,10 +19,6 @@ jest.mock('display/request-bids', () => ({ requestBidsForAd: jest.fn(), })); -jest.mock('config', () => ({ - get: jest.fn(() => false), -})); - jest.mock('define/Advert', () => jest.fn(() => ({ advert: jest.fn() }))); jest.mock('lib/dfp/get-advert-by-id'); diff --git a/src/init/consented/prepare-googletag.spec.ts b/src/init/consented/prepare-googletag.spec.ts index a512e9779..e35f47d34 100644 --- a/src/init/consented/prepare-googletag.spec.ts +++ b/src/init/consented/prepare-googletag.spec.ts @@ -46,12 +46,12 @@ jest.mock('lib/identity/api', () => ({ getGoogleTagId: jest.fn().mockResolvedValue('test-id-string'), getUrl: jest.fn(), })); -jest.mock('lib/analytics/beacon', () => void {}); jest.mock('lib/detect/detect-breakpoint', () => ({ getCurrentBreakpoint: jest.fn(), hasCrossedBreakpoint: jest.fn(), })); + jest.mock('display/display-lazy-ads', () => ({ displayLazyAds: jest.fn(), })); @@ -109,15 +109,14 @@ jest.mock('@guardian/libs', () => { }, }; }); + jest.mock( 'lodash-es/once', () => (fn: (...args: unknown[]) => T) => fn, ); -jest.mock('lib/analytics/beacon', () => ({ - fire: jest.fn(), -})); + jest.mock('display/load-advert', () => ({ loadAdvert: jest.fn(), })); diff --git a/src/lib/__mocks__/config.js b/src/lib/__mocks__/config.js deleted file mode 100644 index 2aa928da9..000000000 --- a/src/lib/__mocks__/config.js +++ /dev/null @@ -1,17 +0,0 @@ -export default { - get(path, defaultValue) { - const value = path.split('.').reduce((acc, prop) => { - if (acc[prop]) { - return acc[prop]; - } - - return defaultValue; - }, this); - - if (typeof value !== 'undefined') { - return value; - } - - return defaultValue; - }, -};