-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): import listens after first sign in
Previously it took a minute until the import was started within the normal loop. This way, we create an import job right after the user logs in for the first time.
- Loading branch information
Showing
3 changed files
with
33 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,36 @@ | ||
import { JobService } from "@apricote/nest-pg-boss"; | ||
import { Test, TestingModule } from "@nestjs/testing"; | ||
import { IImportSpotifyJob, ImportSpotifyJob } from "../sources/jobs"; | ||
import { UserRepository } from "./user.repository"; | ||
import { UsersService } from "./users.service"; | ||
|
||
describe("UsersService", () => { | ||
let service: UsersService; | ||
let userRepository: UserRepository; | ||
let importSpotifyJobService: JobService<IImportSpotifyJob>; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [ | ||
UsersService, | ||
{ provide: UserRepository, useFactory: () => ({}) }, | ||
{ | ||
provide: ImportSpotifyJob.ServiceProvider.provide, | ||
useFactory: () => ({}), | ||
}, | ||
], | ||
}).compile(); | ||
|
||
service = module.get<UsersService>(UsersService); | ||
userRepository = module.get<UserRepository>(UserRepository); | ||
importSpotifyJobService = module.get<JobService<IImportSpotifyJob>>( | ||
ImportSpotifyJob.ServiceProvider.provide | ||
); | ||
}); | ||
|
||
it("should be defined", () => { | ||
expect(service).toBeDefined(); | ||
expect(userRepository).toBeDefined(); | ||
expect(importSpotifyJobService).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters