-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix script options + queue id type fix
- Loading branch information
1 parent
78c81ca
commit 929f061
Showing
9 changed files
with
34 additions
and
36 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
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
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
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 |
---|---|---|
|
@@ -4,23 +4,29 @@ import { cleanRedis } from '../../../../test/RedisCleaner.js' | |
import type { TestContext } from '../../../../test/TestContext.js' | ||
import { createTestContext, destroyTestContext } from '../../../../test/TestContext.js' | ||
|
||
import type { QueueManager } from '@lokalise/background-jobs-common' | ||
import { user as userTable } from '../../../db/schema/user.js' | ||
import type { BullmqSupportedQueues } from '../../../infrastructure/commonDiConfig.js' | ||
import { UserImportJob } from './UserImportJob.js' | ||
|
||
describe('UserImportJob', () => { | ||
let testContext: TestContext | ||
|
||
let userImportJob: UserImportJob | ||
let bullmqQueueManager: QueueManager<BullmqSupportedQueues> | ||
|
||
beforeAll(async () => { | ||
testContext = await createTestContext( | ||
{}, | ||
{ | ||
enqueuedJobsEnabled: [UserImportJob.QUEUE_ID], | ||
backgroundQueuesEnabled: [UserImportJob.QUEUE_ID], | ||
}, | ||
) | ||
await cleanRedis(testContext.diContainer.cradle.redis) | ||
await cleanTables(testContext.diContainer.cradle.drizzle, [DB_MODEL.User]) | ||
userImportJob = testContext.diContainer.cradle.userImportJob | ||
bullmqQueueManager = testContext.diContainer.cradle.bullmqQueueManager | ||
}) | ||
|
||
afterAll(async () => { | ||
|
@@ -34,16 +40,11 @@ describe('UserImportJob', () => { | |
email: '[email protected]', | ||
} | ||
|
||
const jobId = await userImportJob.schedule({ | ||
payload: userData, | ||
metadata: { | ||
correlationId: 'dummy', | ||
}, | ||
const jobId = await bullmqQueueManager.schedule('UserImportJob', { | ||
...userData, | ||
metadata: { correlationId: 'dummy' }, | ||
}) | ||
const result = await testContext.diContainer.cradle.userImportJob.spy.waitForJobWithId( | ||
jobId, | ||
'completed', | ||
) | ||
const result = await userImportJob.spy.waitForJobWithId(jobId, 'completed') | ||
|
||
const users = await testContext.diContainer.cradle.drizzle.select().from(userTable) | ||
expect(users).toHaveLength(1) | ||
|
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