From b1bed00ad4faa9c78cc737cace37c2d201af1b4a Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 13 Feb 2023 16:03:47 +0100 Subject: [PATCH] fix user model spec --- backend/src/models/User.spec.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/src/models/User.spec.js b/backend/src/models/User.spec.js index c64d1fd37..17f2fe0a9 100644 --- a/backend/src/models/User.spec.js +++ b/backend/src/models/User.spec.js @@ -1,6 +1,7 @@ import { cleanDatabase } from '../db/factories' -import { getNeode } from '../db/neo4j' +import { getNeode, getDriver } from '../db/neo4j' +const driver = getDriver() const neode = getNeode() beforeAll(async () => { @@ -9,6 +10,7 @@ beforeAll(async () => { afterAll(async () => { await cleanDatabase() + driver.close() }) // TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543 @@ -37,11 +39,10 @@ describe('slug', () => { ) }) - it('must be unique', async (done) => { + it('must be unique', async () => { await neode.create('User', { slug: 'Matt' }) try { await expect(neode.create('User', { slug: 'Matt' })).rejects.toThrow('already exists') - done() } catch (error) { throw new Error(` ${error}