Skip to content

Commit c14da22

Browse files
authored
fix: TTL-836 customer duplicated error message (#999)
* fix: TTL-836 customer duplicated error message
1 parent b5276b9 commit c14da22

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/app/modules/customer-management/store/customer-management.effects.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,12 @@ describe('CustomerEffects', () => {
8888

8989
it('action type is CREATE_CUSTOMER_FAIL when service fail in execution', async () => {
9090
actions$ = of({ type: CustomerManagementActionTypes.CREATE_CUSTOMER, payload: customer });
91+
9192
spyOn(toastrService, 'error');
92-
spyOn(service, 'createCustomer').and.returnValue(throwError({ error: { message: 'fail!' } }));
93+
spyOn(service, 'createCustomer').and.returnValue(throwError({ error: 'Duplicated' }));
9394

9495
effects.createCustomer$.subscribe((action) => {
95-
expect(toastrService.error).toHaveBeenCalled();
96+
expect(toastrService.error).toHaveBeenCalledWith('Duplicated');
9697
expect(action.type).toEqual(CustomerManagementActionTypes.CREATE_CUSTOMER_FAIL);
9798
});
9899
});

src/app/modules/customer-management/store/customer-management.effects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class CustomerEffects {
4646
return new actions.CreateCustomerSuccess(customerData);
4747
}),
4848
catchError((error) => {
49-
this.toastrService.error(error.error.message);
49+
this.toastrService.error(error.error);
5050
return of(new actions.CreateCustomerFail(error));
5151
})
5252
)

0 commit comments

Comments
 (0)