test: create initial unit tests

This commit is contained in:
Julian Tölle 2021-06-20 00:49:17 +02:00
parent be7fb7d13a
commit e476243b85
16 changed files with 1177 additions and 18 deletions

View file

@ -1,18 +1,25 @@
import { Test, TestingModule } from "@nestjs/testing";
import { UserRepository } from "./user.repository";
import { UsersService } from "./users.service";
describe("UsersService", () => {
let service: UsersService;
let userRepository: UserRepository;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [UsersService],
providers: [
UsersService,
{ provide: UserRepository, useFactory: () => ({}) },
],
}).compile();
service = module.get<UsersService>(UsersService);
userRepository = module.get<UserRepository>(UserRepository);
});
it("should be defined", () => {
expect(service).toBeDefined();
expect(userRepository).toBeDefined();
});
});