Skip to content

Commit 798450a

Browse files
vishalshrm539Sharma
andauthored
Added pcoreMocks to get SBs work with latest DXCB(this is backward compatible) (#491)
Co-authored-by: Sharma <[email protected]>
1 parent 53d9d22 commit 798450a

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

.storybook/preview.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { provideAnimations } from '@angular/platform-browser/animations';
22
import { AngularPConnectService, getSdkComponentMap } from '@pega/angular-sdk-components';
33
import { Preview, applicationConfig } from '@storybook/angular';
4+
import setPCoreMocks from '../__mocks__/pcoreMocks';
5+
6+
setPCoreMocks();
47

58
getSdkComponentMap();
69

__mocks__/pcoreMocks.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export default function setPCoreMocks() {
2+
if (!window.PCore) {
3+
window.PCore = {} as any;
4+
}
5+
6+
window.PCore.getEnvironmentInfo = () => {
7+
return {
8+
getUseLocale: () => 'en-GB',
9+
getLocale: () => 'en-GB',
10+
getTimeZone: () => ''
11+
} as any;
12+
};
13+
14+
window.PCore.getLocaleUtils = () => {
15+
return {
16+
getLocaleValue: (value: any) => value
17+
} as any;
18+
};
19+
20+
window.PCore.getConstants = (): any => {
21+
return {
22+
CASE_INFO: {
23+
INSTRUCTIONS: ''
24+
}
25+
};
26+
};
27+
}

0 commit comments

Comments
 (0)