mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Clean database with neode and Cypress.Promise
This commit is contained in:
parent
b7896f9c4e
commit
6c32104330
@ -1,5 +1,6 @@
|
|||||||
import Factory, { cleanDatabase } from '../../backend/src/db/factories'
|
import Factory from '../../backend/src/db/factories'
|
||||||
import { getDriver, getNeode } from '../../backend/src/db/neo4j'
|
import { getNeode } from '../../backend/src/db/neo4j'
|
||||||
|
|
||||||
|
|
||||||
const neo4jConfigs = {
|
const neo4jConfigs = {
|
||||||
uri: Cypress.env('NEO4J_URI'),
|
uri: Cypress.env('NEO4J_URI'),
|
||||||
@ -8,6 +9,12 @@ const neo4jConfigs = {
|
|||||||
}
|
}
|
||||||
const neodeInstance = getNeode(neo4jConfigs)
|
const neodeInstance = getNeode(neo4jConfigs)
|
||||||
|
|
||||||
|
export const cleanDatabase = () => {
|
||||||
|
return new Cypress.Promise((resolve, _reject) => {
|
||||||
|
return neodeInstance.cypher(' MATCH (everything) DETACH DELETE everything;')
|
||||||
|
.then(() => resolve())
|
||||||
|
})
|
||||||
|
}
|
||||||
beforeEach(() => cleanDatabase())
|
beforeEach(() => cleanDatabase())
|
||||||
|
|
||||||
Cypress.Commands.add('neode', () => {
|
Cypress.Commands.add('neode', () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user