35 lines
978 B
TypeScript
35 lines
978 B
TypeScript
import { Test, TestingModule } from '@nestjs/testing';
|
|
import { NotificationsService } from '@/tracking/notifications.service';
|
|
import { mockShipment, mockTrackingInfo } from '@tests/data/tracking.mock';
|
|
|
|
describe('NotificationsService', () => {
|
|
let service: NotificationsService;
|
|
|
|
beforeEach(async () => {
|
|
const module: TestingModule = await Test.createTestingModule({
|
|
providers: [NotificationsService],
|
|
})
|
|
.useMocker((token) => {
|
|
switch (token) {
|
|
case 'NOTIFIER_FACTORY':
|
|
return () => ({
|
|
send: jest.fn().mockResolvedValue(true),
|
|
});
|
|
}
|
|
})
|
|
.compile();
|
|
|
|
service = module.get<NotificationsService>(NotificationsService);
|
|
});
|
|
|
|
it('should be defined', () => {
|
|
expect(service).toBeDefined();
|
|
});
|
|
|
|
it('should have a method send that resolves', async () => {
|
|
await expect(
|
|
service.send(mockShipment, mockTrackingInfo),
|
|
).resolves.not.toThrow();
|
|
});
|
|
});
|