Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@ import { getSdkComponentMap } from '@pega/react-sdk-components/lib/bridge/helper
import { theme } from '../src/theme';

import { decorator } from '../__mocks__/react_pconnect';
import setPCoreMocks from '../__mocks__/pcoreMocks';

declare global {
interface Window {
PCore?: any;
}
}

const isConstellation = process.env.STORYBOOK_CONSTELLATION;

if (!isConstellation) {
getSdkComponentMap();
}

setPCoreMocks();

const decorators = [
(Story, context) => {
return isConstellation ? (
Expand Down
27 changes: 27 additions & 0 deletions __mocks__/pcoreMocks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export default function setPCoreMocks() {
if (!window.PCore) {
window.PCore = {} as any;
}

window.PCore.getEnvironmentInfo = () => {
return {
getUseLocale: () => 'en-GB',
getLocale: () => 'en-GB',
getTimeZone: () => ''
} as any;
};

window.PCore.getLocaleUtils = () => {
return {
getLocaleValue: (value: any) => value
} as any;
};

window.PCore.getConstants = (): any => {
return {
CASE_INFO: {
INSTRUCTIONS: ''
}
};
};
}
Loading