File tree Expand file tree Collapse file tree 2 files changed +36
-27
lines changed
Expand file tree Collapse file tree 2 files changed +36
-27
lines changed Original file line number Diff line number Diff line change @@ -6,42 +6,21 @@ import { getSdkComponentMap } from '@pega/react-sdk-components/lib/bridge/helper
66import { theme } from '../src/theme' ;
77
88import { decorator } from '../__mocks__/react_pconnect' ;
9+ import setPCoreMocks from '../__mocks__/pcoreMocks' ;
910
1011declare global {
1112 interface Window {
1213 PCore ?: any ;
1314 }
1415}
1516
16- const isConstellation = process . env . STORYBOOK_CONSTELLATION ;
17-
18- const setPCoreMocks = ( ) => {
19- if ( ! window . PCore ) {
20- window . PCore = { } as any ;
17+ declare global {
18+ interface Window {
19+ PCore ?: any ;
2120 }
21+ }
2222
23- window . PCore . getEnvironmentInfo = ( ) => {
24- return {
25- getUseLocale : ( ) => 'en-GB' ,
26- getLocale : ( ) => 'en-GB' ,
27- getTimeZone : ( ) => ''
28- } as any ;
29- } ;
30-
31- window . PCore . getLocaleUtils = ( ) => {
32- return {
33- getLocaleValue : value => value
34- } as any ;
35- } ;
36-
37- window . PCore . getConstants = ( ) : any => {
38- return {
39- CASE_INFO : {
40- INSTRUCTIONS : ''
41- }
42- } ;
43- } ;
44- } ;
23+ const isConstellation = process . env . STORYBOOK_CONSTELLATION ;
4524
4625if ( ! isConstellation ) {
4726 getSdkComponentMap ( ) ;
@@ -103,3 +82,6 @@ const preview: Preview = {
10382} ;
10483
10584export default preview ;
85+ function pcoreMocks ( ) {
86+ throw new Error ( 'Function not implemented.' ) ;
87+ }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments