@@ -159,17 +159,17 @@ describe('atlasSignInReducer', function () {
159159 } ) ;
160160
161161 it ( 'should cancel sign in if sign in is in progress' , async function ( ) {
162- const mockAtlasService = {
163- isAuthenticated : sandbox
164- . stub ( )
165- . onCall ( 0 )
166- . callsFake ( ( { signal } : { signal : AbortSignal } ) => {
167- return new Promise ( ( resolve , reject ) => {
168- signal . addEventListener ( 'abort' , ( ) => {
169- reject ( signal . reason ) ;
170- } ) ;
162+ const isAuthenticatedStub = sandbox
163+ . stub ( )
164+ . callsFake ( ( { signal } : { signal : AbortSignal } ) => {
165+ return new Promise ( ( resolve , reject ) => {
166+ signal . addEventListener ( 'abort' , ( ) => {
167+ reject ( signal . reason ) ;
171168 } ) ;
172- } ) ,
169+ } ) ;
170+ } ) ;
171+ const mockAtlasService = {
172+ isAuthenticated : isAuthenticatedStub ,
173173 } ;
174174 const store = configureStore ( {
175175 atlasAuthService : mockAtlasService as any ,
@@ -182,6 +182,8 @@ describe('atlasSignInReducer', function () {
182182 await new Promise ( ( resolve ) => setTimeout ( resolve , 100 ) ) ;
183183 store . dispatch ( cancelSignIn ( ) ) ;
184184 expect ( store . getState ( ) ) . to . have . nested . property ( 'state' , 'canceled' ) ;
185+
186+ expect ( isAuthenticatedStub ) . to . have . been . calledOnce ;
185187 } ) ;
186188 } ) ;
187189
0 commit comments