Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ describe('CustomerEffects', () => {

it('action type is CREATE_CUSTOMER_FAIL when service fail in execution', async () => {
actions$ = of({ type: CustomerManagementActionTypes.CREATE_CUSTOMER, payload: customer });

spyOn(toastrService, 'error');
spyOn(service, 'createCustomer').and.returnValue(throwError({ error: { message: 'fail!' } }));
spyOn(service, 'createCustomer').and.returnValue(throwError({ error: 'Duplicated' }));

effects.createCustomer$.subscribe((action) => {
expect(toastrService.error).toHaveBeenCalled();
expect(toastrService.error).toHaveBeenCalledWith('Duplicated');
expect(action.type).toEqual(CustomerManagementActionTypes.CREATE_CUSTOMER_FAIL);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class CustomerEffects {
return new actions.CreateCustomerSuccess(customerData);
}),
catchError((error) => {
this.toastrService.error(error.error.message);
this.toastrService.error(error.error);
return of(new actions.CreateCustomerFail(error));
})
)
Expand Down