Skip to content

Commit

Permalink
add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
techMedMau committed Mar 19, 2024
1 parent 4dc0c6d commit d276a93
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/web/app/components/toast/toast.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,23 @@ describe('ToastComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});

it('should set autohide', () => {
component.toast = { message: 'Test message', autohide: false, classes: '' };
component.setAutohide(true);
expect(component.toast.autohide).toBe(true);
});

it('should remove toast', () => {
component.toast = { message: 'Test message', autohide: false, classes: '' };
jest.spyOn(component.toastChange, 'emit');
component.removeToast();
expect(component.toast).toBe(null);
expect(component.toastChange.emit).toHaveBeenCalledWith(null);
});

it('should return false if message is not a TemplateRef', () => {
component.toast = { message: 'Test message', autohide: false, classes: '' };
expect(component.isTemplate()).toBe(false);
});
});

0 comments on commit d276a93

Please sign in to comment.