Skip to content

Commit

Permalink
chore: testing whether test coverage increased or not?
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth9890 committed Jan 18, 2024
1 parent 5c9c0ef commit cdcdce2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions __mocks__/auth.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const AuthMockService = (auth: Auth) => ({
.mockResolvedValue({
checkUsernameAvailability: true,
}),

addEmailMock: jest.spyOn(auth.sdk, 'addEmail_mutation').mockResolvedValue({
addEmail: authStub(),
}),
Expand Down
1 change: 0 additions & 1 deletion src/utils/errorHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ export const errorHandler = (error: any): string => {
return error.message;
}
}

return 'Something went wrong!';
};
9 changes: 9 additions & 0 deletions test/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ describe('AUTH SERVICE TESTING', () => {
expect(checkUsernameAvailabilityMock).toHaveBeenCalled();
});

it('check username availability fail', async () => {
jest
.spyOn(auth.sdk, 'checkUsernameAvailability_query')
.mockRejectedValue(new Error('Failed'));
expect(async () => {
await auth.checkUsernameAvailability(authStub().username);
}).rejects.toThrow('Failed');
});

it('add email', async () => {
const { addEmailMock } = AuthMockService(auth);

Expand Down

0 comments on commit cdcdce2

Please sign in to comment.