Skip to content

Commit

Permalink
[Angular] The signature '(error: any): Observable<never>' of 'throwEr…
Browse files Browse the repository at this point in the history
…ror' is deprecated
  • Loading branch information
qmonmert committed Jan 27, 2024
1 parent 2629a8e commit 3e5e2a5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ describe('PasswordResetInitComponent', () => {
}));

it('no notification of success upon error response', inject([PasswordResetInitService], (service: PasswordResetInitService) => {
const err = { status: 503, data: 'something else' };
jest.spyOn(service, 'save').mockReturnValue(
throwError({
status: 503,
data: 'something else',
})
throwError(() => err)
);
comp.resetRequestForm.patchValue({
email: '[email protected]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,9 @@ describe('RegisterComponent', () => {
it('should notify of user existence upon 400/login already in use', inject(
[RegisterService],
fakeAsync((service: RegisterService) => {
const err = { status: 400, error: { type: LOGIN_ALREADY_USED_TYPE } };
jest.spyOn(service, 'save').mockReturnValue(
throwError({
status: 400,
error: { type: LOGIN_ALREADY_USED_TYPE },
})
throwError(() => err)
);
comp.registerForm.patchValue({
password: 'password',
Expand All @@ -120,11 +118,9 @@ describe('RegisterComponent', () => {
it('should notify of email existence upon 400/email address already in use', inject(
[RegisterService],
fakeAsync((service: RegisterService) => {
const err = { status: 400, error: { type: EMAIL_ALREADY_USED_TYPE } };
jest.spyOn(service, 'save').mockReturnValue(
throwError({
status: 400,
error: { type: EMAIL_ALREADY_USED_TYPE },
})
throwError(() => err)
);
comp.registerForm.patchValue({
password: 'password',
Expand All @@ -143,10 +139,9 @@ describe('RegisterComponent', () => {
it('should notify of generic error', inject(
[RegisterService],
fakeAsync((service: RegisterService) => {
const err = { status: 503 };
jest.spyOn(service, 'save').mockReturnValue(
throwError({
status: 503,
})
throwError(() => err)
);
comp.registerForm.patchValue({
password: 'password',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('SessionsComponent', () => {
fakeAsync((mockAccountService: AccountService, service: SessionsService) => {
mockAccountService.identity = jest.fn(() => of(account));
jest.spyOn(service, 'findAll').mockReturnValue(of(sessions));
jest.spyOn(service, 'delete').mockReturnValue(throwError({}));
jest.spyOn(service, 'delete').mockReturnValue(throwError(() => {}));

comp.ngOnInit();
comp.invalidate('xyz');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ describe('LoginComponent', () => {

it('should stay on login form and show error message on login error', () => {
// GIVEN
mockLoginService.login = jest.fn(() => throwError({}));
mockLoginService.login = jest.fn(() => throwError(() => {}));

// WHEN
comp.login();
Expand Down

0 comments on commit 3e5e2a5

Please sign in to comment.