Skip to content

Commit

Permalink
fix: provide replica db connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Samika Kashyap committed May 22, 2024
1 parent 6ecf8a3 commit c5055d1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/controllers/__tests__/request-controller.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, jest, test, beforeAll, afterAll } from '@jest/globals'
import { createDbConnection, clearTables } from '../../db-connection.js'
import { createDbConnection, clearTables, createReplicaDbConnection } from '../../db-connection.js'
import { createInjector, Injector } from 'typed-inject'
import { config } from 'node-config-ts'
import { RequestController } from '../request-controller.js'
Expand Down Expand Up @@ -83,15 +83,18 @@ class MockMetadataService implements IMetadataService {
// are detected in a CAR file
describe('createRequest', () => {
let dbConnection: Knex
let replicaDbConnection: Knex
let container: Injector<Tokens>
let controller: RequestController

beforeAll(async () => {
dbConnection = await createDbConnection()
replicaDbConnection = await createReplicaDbConnection()
await clearTables(dbConnection)
container = createInjector()
.provideValue('config', config)
.provideValue('dbConnection', dbConnection)
.provideValue('replicaDbConnection', replicaDbConnection)
.provideClass('metadataRepository', MetadataRepository)
.provideFactory('requestRepository', RequestRepository.make)
.provideClass('replicationRequestRepository', ReplicationRequestRepository)
Expand Down Expand Up @@ -372,6 +375,7 @@ describe('createRequest', () => {
queue: { sqsQueueUrl: 'testurl' },
})
.provideValue('dbConnection', dbConnection)
.provideValue('replicaDbConnection', replicaDbConnection)
.provideClass('metadataRepository', MetadataRepository)
.provideFactory('requestRepository', RequestRepository.make)
.provideClass('replicationRequestRepository', ReplicationRequestRepository)
Expand Down

0 comments on commit c5055d1

Please sign in to comment.