Skip to content

Commit d00d9b5

Browse files
committed
Remove traversal tests
1 parent e7bac85 commit d00d9b5

File tree

4 files changed

+1
-179
lines changed

4 files changed

+1
-179
lines changed

src/graph.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
collectionToString,
1818
DocumentCollection,
1919
EdgeCollection,
20-
TraversalOptions,
2120
} from "./collection.js";
2221
import { Database } from "./database.js";
2322
import {
@@ -1756,51 +1755,4 @@ export class Graph {
17561755
(res) => res.parsedBody.graph
17571756
);
17581757
}
1759-
1760-
/**
1761-
* Performs a traversal starting from the given `startVertex` and following
1762-
* edges contained in this graph.
1763-
*
1764-
* See also {@link collection.EdgeCollection#traversal}.
1765-
*
1766-
* @param startVertex - Document `_id` of a vertex in this graph.
1767-
* @param options - Options for performing the traversal.
1768-
*
1769-
* @deprecated Simple Queries have been deprecated in ArangoDB 3.4 and are
1770-
* no longer supported in ArangoDB 3.12. They can be replaced with AQL queries.
1771-
*
1772-
* @example
1773-
* ```js
1774-
* const db = new Database();
1775-
* const graph = db.graph("my-graph");
1776-
* const collection = graph.edgeCollection("edges").collection;
1777-
* await collection.import([
1778-
* ["_key", "_from", "_to"],
1779-
* ["x", "vertices/a", "vertices/b"],
1780-
* ["y", "vertices/b", "vertices/c"],
1781-
* ["z", "vertices/c", "vertices/d"],
1782-
* ]);
1783-
* const startVertex = "vertices/a";
1784-
* const cursor = await db.query(aql`
1785-
* FOR vertex IN OUTBOUND ${startVertex} GRAPH ${graph}
1786-
* RETURN vertex._key
1787-
* `);
1788-
* const result = await cursor.all();
1789-
* console.log(result); // ["a", "b", "c", "d"]
1790-
* ```
1791-
*/
1792-
traversal(startVertex: string, options?: TraversalOptions): Promise<any> {
1793-
return this._db.request(
1794-
{
1795-
method: "POST",
1796-
path: `/_api/traversal`,
1797-
body: {
1798-
...options,
1799-
startVertex,
1800-
graphName: this._name,
1801-
},
1802-
},
1803-
(res) => res.parsedBody.result
1804-
);
1805-
}
18061758
}

src/test/15-edge-collections.ts

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { expect } from "chai";
2-
import { DocumentCollection, EdgeCollection } from "../collection.js";
2+
import { EdgeCollection } from "../collection.js";
33
import { Database } from "../database.js";
44
import { DocumentMetadata } from "../documents.js";
55
import { config } from "./_config.js";
66

7-
const describePre312 = config.arangoVersion < 31200 ? describe : describe.skip;
8-
97
describe("EdgeCollection API", function () {
108
const name = `testdb_${Date.now()}`;
119
let system: Database, db: Database;
@@ -175,59 +173,6 @@ describe("EdgeCollection API", function () {
175173
expect(doc._to).to.equal(data._to);
176174
});
177175
});
178-
describePre312("edgeCollection.traversal", () => {
179-
let knows: EdgeCollection;
180-
beforeEach(async () => {
181-
let person: DocumentCollection;
182-
[knows, person] = await Promise.all([
183-
db.createEdgeCollection("knows"),
184-
db.createCollection("person"),
185-
]);
186-
await db.waitForPropagation(
187-
{ path: `/_api/collection/${person.name}` },
188-
10000
189-
);
190-
await db.waitForPropagation(
191-
{ path: `/_api/collection/${knows.name}` },
192-
10000
193-
);
194-
await Promise.all([
195-
person.import([
196-
{ _key: "Alice" },
197-
{ _key: "Bob" },
198-
{ _key: "Charlie" },
199-
{ _key: "Dave" },
200-
{ _key: "Eve" },
201-
]),
202-
knows.import([
203-
{ _from: "person/Alice", _to: "person/Bob" },
204-
{ _from: "person/Bob", _to: "person/Charlie" },
205-
{ _from: "person/Bob", _to: "person/Dave" },
206-
{ _from: "person/Eve", _to: "person/Alice" },
207-
{ _from: "person/Eve", _to: "person/Bob" },
208-
]),
209-
]);
210-
});
211-
it("executes traversal", async () => {
212-
const result = await knows.traversal("person/Alice", {
213-
direction: "outbound",
214-
});
215-
expect(result).to.have.property("visited");
216-
const visited = result.visited;
217-
expect(visited).to.have.property("vertices");
218-
const vertices = visited.vertices;
219-
expect(vertices).to.be.instanceOf(Array);
220-
expect(vertices.length).to.equal(4);
221-
const names = vertices.map((d: any) => d._key);
222-
for (const name of ["Alice", "Bob", "Charlie", "Dave"]) {
223-
expect(names).to.contain(name);
224-
}
225-
expect(visited).to.have.property("paths");
226-
const paths = visited.paths;
227-
expect(paths).to.be.instanceOf(Array);
228-
expect(paths.length).to.equal(4);
229-
});
230-
});
231176
describe("edgeCollection.replace", () => {
232177
it("replaces the given edge", async () => {
233178
const data = { potato: "tomato", _from: "d/1", _to: "d/2" };

src/test/18-graph-edges.ts

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { Database } from "../database.js";
33
import { Graph } from "../graph.js";
44
import { config } from "./_config.js";
55

6-
const describePre312 = config.arangoVersion < 31200 ? describe : describe.skip;
7-
86
describe("Manipulating graph edges", function () {
97
const dbName = `testdb_${Date.now()}`;
108
const graphName = `testgraph_${Date.now()}`;
@@ -138,45 +136,4 @@ describe("Manipulating graph edges", function () {
138136
expect(info.edgeDefinitions.length).to.equal(0);
139137
});
140138
});
141-
describePre312("graph.traversal", () => {
142-
beforeEach(async () => {
143-
const knows = graph.edgeCollection("knows");
144-
const person = graph.vertexCollection("person");
145-
await Promise.all([
146-
person.collection.import([
147-
{ _key: "Alice" },
148-
{ _key: "Bob" },
149-
{ _key: "Charlie" },
150-
{ _key: "Dave" },
151-
{ _key: "Eve" },
152-
]),
153-
knows.collection.import([
154-
{ _from: "person/Alice", _to: "person/Bob" },
155-
{ _from: "person/Bob", _to: "person/Charlie" },
156-
{ _from: "person/Bob", _to: "person/Dave" },
157-
{ _from: "person/Eve", _to: "person/Alice" },
158-
{ _from: "person/Eve", _to: "person/Bob" },
159-
]),
160-
]);
161-
});
162-
it("executes traversal", async () => {
163-
const result = await graph.traversal("person/Alice", {
164-
direction: "outbound",
165-
});
166-
expect(result).to.have.property("visited");
167-
const visited = result.visited;
168-
expect(visited).to.have.property("vertices");
169-
const vertices = visited.vertices;
170-
expect(vertices).to.be.instanceOf(Array);
171-
const names = vertices.map((d: any) => d._key);
172-
for (const name of ["Alice", "Bob", "Charlie", "Dave"]) {
173-
expect(names).to.contain(name);
174-
}
175-
expect(vertices.length).to.equal(4);
176-
expect(visited).to.have.property("paths");
177-
const paths = visited.paths;
178-
expect(paths).to.be.instanceOf(Array);
179-
expect(paths.length).to.equal(4);
180-
});
181-
});
182139
});

src/test/20-graph-edge-collections.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { DocumentMetadata } from "../documents.js";
44
import { GraphEdgeCollection } from "../graph.js";
55
import { config } from "./_config.js";
66

7-
const describePre312 = config.arangoVersion < 31200 ? describe : describe.skip;
8-
97
describe("GraphEdgeCollection API", function () {
108
const dbName = `testdb_${Date.now()}`;
119
let system: Database, db: Database;
@@ -118,36 +116,6 @@ describe("GraphEdgeCollection API", function () {
118116
expect(doc._to).to.equal(data._to);
119117
});
120118
});
121-
describePre312("edgeCollection.traversal", () => {
122-
beforeEach(async () => {
123-
await collection.collection.import([
124-
{ _from: "person/Alice", _to: "person/Bob" },
125-
{ _from: "person/Bob", _to: "person/Charlie" },
126-
{ _from: "person/Bob", _to: "person/Dave" },
127-
{ _from: "person/Eve", _to: "person/Alice" },
128-
{ _from: "person/Eve", _to: "person/Bob" },
129-
]);
130-
});
131-
it("executes traversal", async () => {
132-
const result = await collection.collection.traversal("person/Alice", {
133-
direction: "outbound",
134-
});
135-
expect(result).to.have.property("visited");
136-
const visited = result.visited;
137-
expect(visited).to.have.property("vertices");
138-
const vertices = visited.vertices;
139-
expect(vertices).to.be.instanceOf(Array);
140-
expect(vertices.length).to.equal(4);
141-
const names = vertices.map((d: any) => d._key);
142-
for (const name of ["Alice", "Bob", "Charlie", "Dave"]) {
143-
expect(names).to.contain(name);
144-
}
145-
expect(visited).to.have.property("paths");
146-
const paths = visited.paths;
147-
expect(paths).to.be.instanceOf(Array);
148-
expect(paths.length).to.equal(4);
149-
});
150-
});
151119
describe("edgeCollection.replace", () => {
152120
it("replaces the given edge", async () => {
153121
const data = {

0 commit comments

Comments
 (0)