Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions packages/fxa-settings/src/models/mocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,27 @@ export function mockSession(
}

export function mockAuthClient() {
const mockSessionStatus = {
state: 'verified',
details: {
verified: true,
accountEmailVerified: true,
sessionVerified: true,
sessionVerificationMeetsMinimumAAL: true,
sessionVerificationMethod: 'email',
},
};
// There are plenty more methods to mock here, but this is these are the ones
// that get commonly used.
return {
sessionStatus: jest.fn().mockReturnValue({
state: 'verified',
details: {
verified: true,
accountEmailVerified: true,
sessionVerified: true,
sessionVerificationMeetsMinimumAAL: true,
sessionVerificationMethod: 'email',
},
}),
} as unknown as AuthClient;
if (typeof jest !== 'undefined') {
return {
sessionStatus: jest.fn().mockResolvedValue(mockSessionStatus),
} as unknown as AuthClient;
} else {
return {
sessionStatus: () => Promise.resolve(mockSessionStatus),
} as unknown as AuthClient;
}
}

export function mockSensitiveDataClient() {
Expand Down
Loading