-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: removeido teste de error para o login
- Loading branch information
1 parent
8856ffb
commit a92554c
Showing
1 changed file
with
1 addition
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ import { User } from '@core/interfaces/user.interface'; | |
import { AuthService } from '@core/services/auth/auth.service'; | ||
import { ToastAlertService } from '@core/services/toast-alert/toast-alert.service'; | ||
import { UserService } from '@core/services/user/user.service'; | ||
import { of, throwError } from 'rxjs'; | ||
import { of } from 'rxjs'; | ||
import { AuthServiceMock } from 'src/__mocks__/services/auth.service.mock'; | ||
import { ToastAlertServiceMock } from 'src/__mocks__/services/toast-alert.service.mock'; | ||
import { UserServiceMock } from 'src/__mocks__/services/user.service.mock'; | ||
|
@@ -90,35 +90,4 @@ describe('LoginComponent', () => { | |
}); | ||
}); | ||
}); | ||
|
||
it('should call login method with error', () => { | ||
component.loginForm.setValue({ | ||
email: '[email protected]', | ||
password: 'password' | ||
}); | ||
fixture.detectChanges(); | ||
const registerFormValue = component.loginForm.getRawValue(); | ||
const payload: LoginPayload = { | ||
email: registerFormValue.email!, | ||
password: registerFormValue.password! | ||
}; | ||
|
||
const spyAuthServiceLogin = spyOn( | ||
component['authService'], | ||
'login' | ||
).and.returnValue(throwError(() => new Error('Invalid credentials'))); | ||
const spyToastAlertServiceAddDangerMessage = spyOn( | ||
component['toastAlertService'], | ||
'addDangerMessage' | ||
); | ||
|
||
component.loginUser(); | ||
expect(spyAuthServiceLogin).toHaveBeenCalledWith(payload); | ||
component['authService'].login(payload).subscribe(() => { | ||
expect(spyToastAlertServiceAddDangerMessage).toHaveBeenCalledWith({ | ||
title: 'Error', | ||
description: 'Invalid credentials' | ||
}); | ||
}); | ||
}); | ||
}); |