import { createTestContext as originalCreateTestContext, TestContext } from 'nexus/testing' async function signIn(ctx: TestContext) { const res = await ctx.client.send(`mutation { signin(email:"test@golo.io", password: "test1234"){ token } }`) return res.signin.token } export function createTestContext(): TestContext { const ctx = {} as TestContext let token = '' beforeAll(async () => { Object.assign(ctx, await originalCreateTestContext()) await ctx.app.start() token = await signIn(ctx) ctx.client.headers.set('Authorization', `Bearer ${token}`) }) afterAll(async () => { await ctx.app.stop() }) return ctx }