File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
packages/template-retail-react-app/app/pages/checkout/partials Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,14 @@ describe('passwordless and social disabled', () => {
105105
106106describe ( 'passwordless enabled' , ( ) => {
107107 let currentBasket = JSON . parse ( JSON . stringify ( scapiBasketWithItem ) )
108+
109+ beforeAll ( ( ) => {
110+ jest . spyOn ( window . localStorage , 'setItem' )
111+ } )
112+
108113 beforeEach ( ( ) => {
114+ window . localStorage . setItem . mockClear ( )
115+
109116 global . server . use (
110117 rest . put ( '*/baskets/:basketId/customer' , ( req , res , ctx ) => {
111118 currentBasket . customerInfo . email = validEmail
@@ -114,6 +121,10 @@ describe('passwordless enabled', () => {
114121 )
115122 } )
116123
124+ afterAll ( ( ) => {
125+ window . localStorage . setItem . mockRestore ( )
126+ } )
127+
117128 test ( 'renders component' , async ( ) => {
118129 const { getByRole} = renderWithProviders ( < ContactInfo isPasswordlessEnabled = { true } /> )
119130 expect ( getByRole ( 'button' , { name : 'Checkout as Guest' } ) ) . toBeInTheDocument ( )
@@ -166,6 +177,7 @@ describe('passwordless enabled', () => {
166177 const withinForm = within ( screen . getByTestId ( 'sf-form-resend-passwordless-email' ) )
167178 expect ( withinForm . getByText ( / C h e c k Y o u r E m a i l / i) ) . toBeInTheDocument ( )
168179 expect ( withinForm . getByText ( validEmail ) ) . toBeInTheDocument ( )
180+ expect ( window . localStorage . setItem ) . toHaveBeenCalled ( )
169181 } )
170182
171183 // resend the email
You can’t perform that action at this time.
0 commit comments