From ca69d229930e9618e43ae724f338bb5f4971154d Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 25 Oct 2024 18:51:04 +0530 Subject: [PATCH] Fix unit tests --- pnpm-lock.yaml | 3 +++ projects/js-packages/publicize-components/src/store/index.ts | 2 +- .../js-packages/publicize-components/src/utils/script-data.ts | 2 +- projects/plugins/jetpack/package.json | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f6233c96228d1..cd3a55ff8c628 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3795,6 +3795,9 @@ importers: '@automattic/jetpack-publicize-components': specifier: workspace:* version: link:../../js-packages/publicize-components + '@automattic/jetpack-script-data': + specifier: workspace:* + version: link:../../js-packages/script-data '@automattic/jetpack-shared-extension-utils': specifier: workspace:* version: link:../../js-packages/shared-extension-utils diff --git a/projects/js-packages/publicize-components/src/store/index.ts b/projects/js-packages/publicize-components/src/store/index.ts index 20ad8f29b6cd7..bec435243270a 100644 --- a/projects/js-packages/publicize-components/src/store/index.ts +++ b/projects/js-packages/publicize-components/src/store/index.ts @@ -17,7 +17,7 @@ export const socialStore = createReduxStore( 'jetpack-social', { resolvers: { ...sig.resolvers, }, - initialState: getSocialScriptData().store_initial_state, + initialState: getSocialScriptData()?.store_initial_state, } ); register( socialStore ); diff --git a/projects/js-packages/publicize-components/src/utils/script-data.ts b/projects/js-packages/publicize-components/src/utils/script-data.ts index 25561a8b726f2..1a954bc7e7894 100644 --- a/projects/js-packages/publicize-components/src/utils/script-data.ts +++ b/projects/js-packages/publicize-components/src/utils/script-data.ts @@ -7,7 +7,7 @@ import { SocialScriptData } from '../types/types'; * @return {SocialScriptData} The social script data. */ export function getSocialScriptData(): SocialScriptData { - return getScriptData().social; + return getScriptData()?.social; } /** diff --git a/projects/plugins/jetpack/package.json b/projects/plugins/jetpack/package.json index 97da3db04ed14..2d63725065d7d 100644 --- a/projects/plugins/jetpack/package.json +++ b/projects/plugins/jetpack/package.json @@ -57,6 +57,7 @@ "@automattic/jetpack-my-jetpack": "workspace:*", "@automattic/jetpack-partner-coupon": "workspace:*", "@automattic/jetpack-publicize-components": "workspace:*", + "@automattic/jetpack-script-data": "workspace:*", "@automattic/jetpack-shared-extension-utils": "workspace:*", "@automattic/popup-monitor": "1.0.2", "@automattic/request-external-access": "1.0.0",