Skip to content

Commit

Permalink
Work around graph integrity safeguards in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pluma4345 committed Feb 13, 2024
1 parent b660377 commit 3c4c9c7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 14 additions & 6 deletions src/test/16-graphs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/test/17-graph-vertices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3c4c9c7

Please sign in to comment.