2023-03-12 02:13:59 +01:00
|
|
|
import { JobService } from "@apricote/nest-pg-boss";
|
2020-01-25 22:19:14 +01:00
|
|
|
import { Test, TestingModule } from "@nestjs/testing";
|
2023-03-12 02:13:59 +01:00
|
|
|
import { IImportSpotifyJob, ImportSpotifyJob } from "../sources/jobs";
|
2021-06-20 00:49:17 +02:00
|
|
|
import { UserRepository } from "./user.repository";
|
2020-02-01 16:11:48 +01:00
|
|
|
import { UsersService } from "./users.service";
|
2020-01-25 22:19:14 +01:00
|
|
|
|
2020-02-01 16:11:48 +01:00
|
|
|
describe("UsersService", () => {
|
|
|
|
|
let service: UsersService;
|
2021-06-20 00:49:17 +02:00
|
|
|
let userRepository: UserRepository;
|
2023-03-12 02:13:59 +01:00
|
|
|
let importSpotifyJobService: JobService<IImportSpotifyJob>;
|
2020-01-25 22:19:14 +01:00
|
|
|
|
|
|
|
|
beforeEach(async () => {
|
|
|
|
|
const module: TestingModule = await Test.createTestingModule({
|
2021-06-20 00:49:17 +02:00
|
|
|
providers: [
|
|
|
|
|
UsersService,
|
|
|
|
|
{ provide: UserRepository, useFactory: () => ({}) },
|
2023-03-12 02:13:59 +01:00
|
|
|
{
|
|
|
|
|
provide: ImportSpotifyJob.ServiceProvider.provide,
|
|
|
|
|
useFactory: () => ({}),
|
|
|
|
|
},
|
2021-06-20 00:49:17 +02:00
|
|
|
],
|
2020-01-25 22:19:14 +01:00
|
|
|
}).compile();
|
|
|
|
|
|
2020-02-01 16:11:48 +01:00
|
|
|
service = module.get<UsersService>(UsersService);
|
2021-06-20 00:49:17 +02:00
|
|
|
userRepository = module.get<UserRepository>(UserRepository);
|
2023-03-12 02:13:59 +01:00
|
|
|
importSpotifyJobService = module.get<JobService<IImportSpotifyJob>>(
|
|
|
|
|
ImportSpotifyJob.ServiceProvider.provide
|
|
|
|
|
);
|
2020-01-25 22:19:14 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should be defined", () => {
|
|
|
|
|
expect(service).toBeDefined();
|
2021-06-20 00:49:17 +02:00
|
|
|
expect(userRepository).toBeDefined();
|
2023-03-12 02:13:59 +01:00
|
|
|
expect(importSpotifyJobService).toBeDefined();
|
2020-01-25 22:19:14 +01:00
|
|
|
});
|
|
|
|
|
});
|