diff --git a/src/test/16-graphs.ts b/src/test/16-graphs.ts index 39bf2ee4..d6306e32 100644 --- a/src/test/16-graphs.ts +++ b/src/test/16-graphs.ts @@ -80,20 +80,28 @@ describe("Graph API", function () { describe("graph.create", () => { let edgeCollectionNames: string[]; let vertexCollectionNames: string[]; + let graph: Graph; before(async () => { [vertexCollectionNames, edgeCollectionNames] = await createCollections( db ); }); after(async () => { - await Promise.all( - [...edgeCollectionNames, ...vertexCollectionNames].map((name) => - db.collection(name).drop() - ) - ); + await Promise.all([ + ...edgeCollectionNames.map(async (name) => { + try { + await graph.removeEdgeDefinition(name, true); + } catch {} + }), + ...vertexCollectionNames.map(async (name) => { + try { + await graph.removeVertexCollection(name, true); + } catch {} + }), + ]); }); it("creates the graph", async () => { - const graph = db.graph(`g_${Date.now()}`); + graph = db.graph(`g_${Date.now()}`); await graph.create( edgeCollectionNames.map((name) => ({ collection: name, diff --git a/src/test/17-graph-vertices.ts b/src/test/17-graph-vertices.ts index e1590201..f8ddcbf9 100644 --- a/src/test/17-graph-vertices.ts +++ b/src/test/17-graph-vertices.ts @@ -96,7 +96,7 @@ describe("Manipulating graph vertices", function () { ); }); afterEach(async () => { - await vertexCollection.drop(); + await graph.removeVertexCollection(vertexCollection.name, true); }); it("adds the given vertex collection to the graph", async () => { const data = await graph.addVertexCollection(vertexCollection.name);