File tree Expand file tree Collapse file tree
packages/fxa-settings/src/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -124,20 +124,27 @@ export function mockSession(
124124}
125125
126126export function mockAuthClient ( ) {
127+ const mockSessionStatus = {
128+ state : 'verified' ,
129+ details : {
130+ verified : true ,
131+ accountEmailVerified : true ,
132+ sessionVerified : true ,
133+ sessionVerificationMeetsMinimumAAL : true ,
134+ sessionVerificationMethod : 'email' ,
135+ } ,
136+ } ;
127137 // There are plenty more methods to mock here, but this is these are the ones
128138 // that get commonly used.
129- return {
130- sessionStatus : jest . fn ( ) . mockReturnValue ( {
131- state : 'verified' ,
132- details : {
133- verified : true ,
134- accountEmailVerified : true ,
135- sessionVerified : true ,
136- sessionVerificationMeetsMinimumAAL : true ,
137- sessionVerificationMethod : 'email' ,
138- } ,
139- } ) ,
140- } as unknown as AuthClient ;
139+ if ( typeof jest !== 'undefined' ) {
140+ return {
141+ sessionStatus : jest . fn ( ) . mockResolvedValue ( mockSessionStatus ) ,
142+ } as unknown as AuthClient ;
143+ } else {
144+ return {
145+ sessionStatus : ( ) => Promise . resolve ( mockSessionStatus ) ,
146+ } as unknown as AuthClient ;
147+ }
141148}
142149
143150export function mockSensitiveDataClient ( ) {
You can’t perform that action at this time.
0 commit comments