Hello I have following setup for unit test:
import { Test, TestingModule } from '@nestjs/testing';
import { BlockchainService } from '../blockchain/blockchain.service';
import { FaucetService } from '../faucet/faucet.service';
import { UserController } from './user.controller';
import { UserService } from './user.service';
describe('UserController', () => {
let controller: UserController;
let userService: UserService;
let faucetService: FaucetService;
let blockchainService: BlockchainService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [UserController],
providers: [UserService, FaucetService, BlockchainService],
}).compile();
controller = module.get<UserController>(UserController);
userService = module.get<UserService>(UserService);
faucetService = module.get<FaucetService>(FaucetService);
blockchainService = module.get<BlockchainService>(BlockchainService);
});
// it('should be defined', () => {
// expect(controller).toBeDefined();
// });
});
Issue is that when I run the tests this is the response:
Cannot find module 'src/config/app.config' from 'modules/user/user.service.ts'
AppConfig is util object which contains env.variables, my question is how to import/mock this object and other utils functions so my test could compile successfully.
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire