hack to close the dn connection after tests

This commit is contained in:
Moriz Wahl 2021-10-19 18:48:21 +02:00
parent f8942f048b
commit 1def630e3b
2 changed files with 11 additions and 4 deletions

View File

@ -9,10 +9,17 @@ jest.mock('../../config')
let query: any
beforeAll(async () => {
const { apollo } = await createServer({})
// to do: We need a setup for the tests that closes the connection
let con: any
query = createTestClient(apollo).query
beforeAll(async () => {
const server = await createServer({})
con = server.con
query = createTestClient(server.apollo).query
})
afterAll(async () => {
await con.close()
})
describe('CommunityResolver', () => {

View File

@ -57,7 +57,7 @@ const createServer = async (context: any = serverContext): Promise<any> => {
plugins,
})
apollo.applyMiddleware({ app })
return { apollo, app }
return { apollo, app, con }
}
export default createServer