@@ -9,10 +9,18 @@ import { getQuery } from '@woocommerce/navigation';
9
9
/**
10
10
* Internal dependencies
11
11
*/
12
- import CampaignCreationSuccessGuide from './index' ;
12
+ import Dashboard from './index' ;
13
13
import isWCTracksEnabled from '.~/utils/isWCTracksEnabled' ;
14
14
import { GUIDE_NAMES } from '.~/constants' ;
15
15
16
+ jest . mock ( '@woocommerce/settings' , ( ) => {
17
+ return {
18
+ getSetting : ( ) => ( {
19
+ code : 'TWD' ,
20
+ } ) ,
21
+ } ;
22
+ } ) ;
23
+
16
24
jest . mock ( '@woocommerce/navigation' , ( ) => {
17
25
return {
18
26
...jest . requireActual ( '@woocommerce/navigation' ) ,
@@ -30,7 +38,12 @@ jest.mock( '.~/components/customer-effort-score-prompt', () => () => (
30
38
< div > { CES_PROMPT_TEXT } </ div >
31
39
) ) ;
32
40
33
- describe ( 'CampaignCreationSuccessGuide' , ( ) => {
41
+ beforeAll ( ( ) => {
42
+ // Used in the js/src/hooks/useLegacyMenuEffect.js dependency
43
+ window . wpNavMenuClassChange = jest . fn ( ) ;
44
+ } ) ;
45
+
46
+ describe ( 'Dashboard' , ( ) => {
34
47
describe ( `When the query string "guide" equals to ${ GUIDE_NAMES . CAMPAIGN_CREATION_SUCCESS } ` , ( ) => {
35
48
beforeAll ( ( ) => {
36
49
getQuery . mockImplementation ( ( ) => {
@@ -45,7 +58,7 @@ describe( 'CampaignCreationSuccessGuide', () => {
45
58
} ) ;
46
59
47
60
test ( 'Should render CampaignCreationSuccessGuide' , ( ) => {
48
- const { queryByText } = render ( < CampaignCreationSuccessGuide /> ) ;
61
+ const { queryByText } = render ( < Dashboard /> ) ;
49
62
expect (
50
63
queryByText ( CAMPAIGN_CREATION_SUCCESS_GUIDE_TEXT )
51
64
) . toBeInTheDocument ( ) ;
@@ -63,18 +76,14 @@ describe( 'CampaignCreationSuccessGuide', () => {
63
76
} ) ;
64
77
65
78
test ( 'Should not render CustomerEffortScorePrompt when user does not click "Got it"' , ( ) => {
66
- const { queryByText } = render (
67
- < CampaignCreationSuccessGuide />
68
- ) ;
79
+ const { queryByText } = render ( < Dashboard /> ) ;
69
80
expect (
70
81
queryByText ( CES_PROMPT_TEXT )
71
82
) . not . toBeInTheDocument ( ) ;
72
83
} ) ;
73
84
74
85
test ( 'Should not render CustomerEffortScorePrompt when user clicks "Got it"' , ( ) => {
75
- const { queryByText } = render (
76
- < CampaignCreationSuccessGuide />
77
- ) ;
86
+ const { queryByText } = render ( < Dashboard /> ) ;
78
87
userEvent . click ( screen . getByText ( 'Got it' ) ) ;
79
88
80
89
expect (
@@ -95,18 +104,14 @@ describe( 'CampaignCreationSuccessGuide', () => {
95
104
} ) ;
96
105
97
106
test ( 'Should not render CustomerEffortScorePrompt when user does not click "Got it"' , ( ) => {
98
- const { queryByText } = render (
99
- < CampaignCreationSuccessGuide />
100
- ) ;
107
+ const { queryByText } = render ( < Dashboard /> ) ;
101
108
expect (
102
109
queryByText ( CES_PROMPT_TEXT )
103
110
) . not . toBeInTheDocument ( ) ;
104
111
} ) ;
105
112
106
113
test ( 'Should render CustomerEffortScorePrompt when user clicks "Got it"' , ( ) => {
107
- const { queryByText } = render (
108
- < CampaignCreationSuccessGuide />
109
- ) ;
114
+ const { queryByText } = render ( < Dashboard /> ) ;
110
115
userEvent . click ( screen . getByText ( 'Got it' ) ) ;
111
116
112
117
expect ( queryByText ( CES_PROMPT_TEXT ) ) . toBeInTheDocument ( ) ;
@@ -126,7 +131,7 @@ describe( 'CampaignCreationSuccessGuide', () => {
126
131
} ) ;
127
132
128
133
test ( 'Should not render CampaignCreationSuccessGuide' , ( ) => {
129
- const { queryByText } = render ( < CampaignCreationSuccessGuide /> ) ;
134
+ const { queryByText } = render ( < Dashboard /> ) ;
130
135
expect (
131
136
queryByText ( CAMPAIGN_CREATION_SUCCESS_GUIDE_TEXT )
132
137
) . not . toBeInTheDocument ( ) ;
0 commit comments