Skip to content

Commit 1cff4a5

Browse files
committed
✅ add test for alert service
1 parent fc5db6f commit 1cff4a5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/app/core/services/alert.service.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { TestBed } from '@angular/core/testing';
22

3+
import { IAlert } from '@interfaces/alert.interface';
4+
35
import { AlertService } from './alert.service';
46

57
describe('AlertService', () => {
@@ -13,4 +15,15 @@ describe('AlertService', () => {
1315
it('should be created', () => {
1416
expect(service).toBeTruthy();
1517
});
18+
19+
it('should emit an alert', () => {
20+
const alert: IAlert = {
21+
type: 'success',
22+
message: 'Test alert',
23+
};
24+
service.alert.subscribe((data) => {
25+
expect(data).toEqual(alert);
26+
});
27+
service.emitAlert(alert);
28+
});
1629
});

0 commit comments

Comments
 (0)