diff --git a/src/user.spec.js b/src/user.spec.js index ada3f2bcd..0be9a19bf 100644 --- a/src/user.spec.js +++ b/src/user.spec.js @@ -4,22 +4,15 @@ import { createUser, deleteUsers, getConnection, - getMainConnection, - getUser + getUser, + xo } from './util' // =================================================================== describe('user', () => { - let xo let userIds = [] - beforeAll(async () => { - xo = await getMainConnection() - }) - - afterAll(() => xo.close()) - afterEach(async () => { await deleteUsers(xo, userIds) userIds = [] diff --git a/src/util.js b/src/util.js index 423968362..28322f772 100644 --- a/src/util.js +++ b/src/util.js @@ -1,7 +1,9 @@ import expect from 'must' import Xo from 'xo-lib' import XoCollection from 'xo-collection' -import {find, forEach, map, once, cloneDeep} from 'lodash' +import {find, forEach, map, cloneDeep} from 'lodash' + +/* eslint-env jest */ export async function getConfig () { return { @@ -103,7 +105,14 @@ export async function getConnection ({ return xo } -export const getMainConnection = once(getConnection) +export let xo +beforeAll(async () => { + xo = await getConnection() +}) +afterAll(async () => { + await xo.close() + xo = null +}) // =================================================================