mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
test: create initial unit tests
This commit is contained in:
parent
be7fb7d13a
commit
e476243b85
16 changed files with 1177 additions and 18 deletions
|
|
@ -1,18 +1,23 @@
|
|||
import { Test, TestingModule } from "@nestjs/testing";
|
||||
import { ReportsController } from "./reports.controller";
|
||||
import { ReportsService } from "./reports.service";
|
||||
|
||||
describe("Reports Controller", () => {
|
||||
let controller: ReportsController;
|
||||
let reportsService: ReportsService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [ReportsController],
|
||||
providers: [{ provide: ReportsService, useFactory: () => ({}) }],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<ReportsController>(ReportsController);
|
||||
reportsService = module.get<ReportsService>(ReportsService);
|
||||
});
|
||||
|
||||
it("should be defined", () => {
|
||||
expect(controller).toBeDefined();
|
||||
expect(reportsService).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,18 +1,25 @@
|
|||
import { Test, TestingModule } from "@nestjs/testing";
|
||||
import { ListensService } from "../listens/listens.service";
|
||||
import { ReportsService } from "./reports.service";
|
||||
|
||||
describe("ReportsService", () => {
|
||||
let service: ReportsService;
|
||||
let listensService: ListensService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [ReportsService],
|
||||
providers: [
|
||||
ReportsService,
|
||||
{ provide: ListensService, useFactory: () => ({}) },
|
||||
],
|
||||
}).compile();
|
||||
|
||||
service = module.get<ReportsService>(ReportsService);
|
||||
listensService = module.get<ListensService>(ListensService);
|
||||
});
|
||||
|
||||
it("should be defined", () => {
|
||||
expect(service).toBeDefined();
|
||||
expect(listensService).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue