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); }); 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(); }); });