import { Test, TestingModule } from '@nestjs/testing'; import { ShipmentsController } from '@/shipments/shipments.controller'; import { ShipmentsService } from '@/shipments/shipments.service'; describe('ShipmentsController', () => { let controller: ShipmentsController; beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ controllers: [ShipmentsController], }) .useMocker((token) => { if (token === ShipmentsService) { return { getAll: jest.fn().mockResolvedValue([]), }; } }) .compile(); controller = module.get(ShipmentsController); }); it('should be defined', () => { expect(controller).toBeDefined(); }); it('should have a method getShipments', () => { expect(controller.getShipments).toBeDefined(); }); it('should return an object with message: ok', async () => { await expect(controller.getShipments()).resolves.toEqual({ data: [] }); }); });