From b3c260a5dbac8506279dfbf13bfeed050dc67c2e Mon Sep 17 00:00:00 2001 From: Leibale Date: Mon, 30 Jan 2023 14:02:15 -0500 Subject: [PATCH] fix graph tests --- packages/graph/lib/commands/EXPLAIN.spec.ts | 5 ++++- packages/graph/lib/commands/RO_QUERY.spec.ts | 5 ++++- packages/graph/lib/graph.spec.ts | 16 ++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/graph/lib/commands/EXPLAIN.spec.ts b/packages/graph/lib/commands/EXPLAIN.spec.ts index 2919a21163..86d89b212c 100644 --- a/packages/graph/lib/commands/EXPLAIN.spec.ts +++ b/packages/graph/lib/commands/EXPLAIN.spec.ts @@ -11,7 +11,10 @@ describe('EXPLAIN', () => { }); testUtils.testWithClient('client.graph.explain', async client => { - const reply = await client.graph.explain('key', 'RETURN 0'); + const [, reply] = await Promise.all([ + client.graph.query('key', 'RETURN 0'), // make sure to create a graph first + client.graph.explain('key', 'RETURN 0') + ]); assert.ok(Array.isArray(reply)); assert.ok(!reply.find(x => typeof x !== 'string')); }, GLOBAL.SERVERS.OPEN); diff --git a/packages/graph/lib/commands/RO_QUERY.spec.ts b/packages/graph/lib/commands/RO_QUERY.spec.ts index 0fbaeb6953..1d76b1bd65 100644 --- a/packages/graph/lib/commands/RO_QUERY.spec.ts +++ b/packages/graph/lib/commands/RO_QUERY.spec.ts @@ -11,7 +11,10 @@ describe('RO_QUERY', () => { }); testUtils.testWithClient('client.graph.roQuery', async client => { - const { data } = await client.graph.roQuery('key', 'RETURN 0'); + const [, { data }] = await Promise.all([ + client.graph.query('key', 'RETURN 0'), // make sure to create a graph first + client.graph.roQuery('key', 'RETURN 0') + ]); assert.deepEqual(data, [[0]]); }, GLOBAL.SERVERS.OPEN); }); \ No newline at end of file diff --git a/packages/graph/lib/graph.spec.ts b/packages/graph/lib/graph.spec.ts index 51912356d3..ff45759fe8 100644 --- a/packages/graph/lib/graph.spec.ts +++ b/packages/graph/lib/graph.spec.ts @@ -5,7 +5,7 @@ import Graph from './graph'; describe('Graph', () => { testUtils.testWithClient('null', async client => { const graph = new Graph(client as any, 'graph'), - { data } = await graph.roQuery('RETURN null AS key'); + { data } = await graph.query('RETURN null AS key'); assert.deepEqual( data, @@ -15,7 +15,7 @@ describe('Graph', () => { testUtils.testWithClient('string', async client => { const graph = new Graph(client as any, 'graph'), - { data } = await graph.roQuery('RETURN "string" AS key'); + { data } = await graph.query('RETURN "string" AS key'); assert.deepEqual( data, @@ -25,7 +25,7 @@ describe('Graph', () => { testUtils.testWithClient('integer', async client => { const graph = new Graph(client as any, 'graph'), - { data } = await graph.roQuery('RETURN 0 AS key'); + { data } = await graph.query('RETURN 0 AS key'); assert.deepEqual( data, @@ -35,7 +35,7 @@ describe('Graph', () => { testUtils.testWithClient('boolean', async client => { const graph = new Graph(client as any, 'graph'), - { data } = await graph.roQuery('RETURN false AS key'); + { data } = await graph.query('RETURN false AS key'); assert.deepEqual( data, @@ -45,7 +45,7 @@ describe('Graph', () => { testUtils.testWithClient('double', async client => { const graph = new Graph(client as any, 'graph'), - { data } = await graph.roQuery('RETURN 0.1 AS key'); + { data } = await graph.query('RETURN 0.1 AS key'); assert.deepEqual( data, @@ -55,7 +55,7 @@ describe('Graph', () => { testUtils.testWithClient('array', async client => { const graph = new Graph(client as any, 'graph'), - { data } = await graph.roQuery('RETURN [null] AS key'); + { data } = await graph.query('RETURN [null] AS key'); assert.deepEqual( data, @@ -125,7 +125,7 @@ describe('Graph', () => { testUtils.testWithClient('map', async client => { const graph = new Graph(client as any, 'graph'), - { data } = await graph.roQuery('RETURN { key: "value" } AS map'); + { data } = await graph.query('RETURN { key: "value" } AS map'); assert.deepEqual(data, [{ map: { @@ -136,7 +136,7 @@ describe('Graph', () => { testUtils.testWithClient('point', async client => { const graph = new Graph(client as any, 'graph'), - { data } = await graph.roQuery('RETURN point({ latitude: 1, longitude: 2 }) AS point'); + { data } = await graph.query('RETURN point({ latitude: 1, longitude: 2 }) AS point'); assert.deepEqual(data, [{ point: {