Skip to content

Commit

Permalink
test: add tests for findUpToLevel without maxLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
DIY0R committed Sep 19, 2024
1 parent def415d commit 3601ddb
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions test/graph.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,28 @@ describe('Links operations', () => {
await checkLinksPresence(ids[i + 1], ids[i], true);
}
});

test('create arcs between multiple vertices', async () => {
const { ids } = await createVertexArcs(12);
for (let i = 0; i < ids.length - 1; i++)
await checkLinksPresence(ids[i], ids[i + 1], true);
});

test('retrieve all vertices up to the specified depth level in a graph', async () => {
test('retrieve all vertices up to the specified depth level', async () => {
const count = 30;
const { ids, vertices } = await createVertexArcs(count);
const graphTree = await graph.findUpToLevel(vertices[0].id, count);
const graphTree = await graph.findUpToLevel(vertices[0].id, count - 4);
assert.equal(graphTree.length, count - 3);
graphTree.forEach((vertex, index) => {
assert.equal(vertex.level, index);
assert.equal(vertex.id, ids[index]);
});
});

test('retrieve all extract all vertices', async () => {
const count = 15;
const { ids, vertices } = await createVertexArcs(count);
const graphTree = await graph.findUpToLevel(vertices[0].id);
assert.equal(graphTree.length, count);
graphTree.forEach((vertex, index) => {
assert.equal(vertex.level, index);
Expand Down Expand Up @@ -182,7 +194,7 @@ describe('Links operations', () => {
assert.equal(result, true);
});

test('vertices that match the predicate ', async () => {
test('vertices that match the predicate', async () => {
const countVertex = 30;
const { ids } = await createVertexArcs(countVertex);
const check = v => v.data.num % 2 === 0;
Expand Down

0 comments on commit 3601ddb

Please sign in to comment.