From 352a964424702b3bffbb614d012649dfabad2d27 Mon Sep 17 00:00:00 2001 From: Avadh Patel Date: Sun, 4 Mar 2018 11:40:37 -0600 Subject: [PATCH 1/2] Added SaveInPredicates and SaveOutPredicates API functions Signed-off-by: Avadh Patel --- lib/api/gizmo/Path.js | 2 +- test/apis/promise.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/api/gizmo/Path.js b/lib/api/gizmo/Path.js index 0c1e52b..6fad07e 100644 --- a/lib/api/gizmo/Path.js +++ b/lib/api/gizmo/Path.js @@ -22,7 +22,7 @@ class Path { ['Out', 'In', 'Both', 'Is', 'Has', 'LabelContext', 'Limit', 'Skip', 'InPredicates', 'OutPredicates'].forEach(generator); // Tagging - ['Tag', 'As', 'Back', 'Save'].forEach(generator); + ['Tag', 'As', 'Back', 'Save', 'SaveInPredicates', 'SaveOutPredicates'].forEach(generator); //Joining ['Intersect', 'And', 'Union', 'Or', 'Except', 'Difference'].forEach(generator); diff --git a/test/apis/promise.js b/test/apis/promise.js index 66531b8..cff650f 100644 --- a/test/apis/promise.js +++ b/test/apis/promise.js @@ -397,6 +397,18 @@ describe('Cayley bluebird Promise style Gizmo APIs', function() { }); }); + it('path.SaveInPredicates(predicate, tag)', function() { + return cayleyClient.g.V('').SaveInPredicates('target').All().then((res) => { + assert.isArray(res.result); + }); + }); + + it('path.SaveOutPredicates(predicate, tag)', function() { + return cayleyClient.g.V('').SaveOutPredicates('target').All().then((res) => { + assert.isArray(res.result); + }); + }); + it('path.Intersect(query)', function() { const queryA = cayleyClient.g.V('').Out(''); const queryB = cayleyClient.g.V('').Out(''); From e25e2fea1ad5af7f597744676d5132e93299a010 Mon Sep 17 00:00:00 2001 From: Avadh Patel Date: Sun, 18 Mar 2018 23:39:40 -0500 Subject: [PATCH 2/2] Added Unique function to gizmo API Signed-off-by: Avadh Patel --- lib/api/gizmo/Path.js | 3 +++ test/apis/promise.js | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/api/gizmo/Path.js b/lib/api/gizmo/Path.js index 6fad07e..2fdfb57 100644 --- a/lib/api/gizmo/Path.js +++ b/lib/api/gizmo/Path.js @@ -29,6 +29,9 @@ class Path { //Using Morphisms ['Follow', 'FollowR'].forEach(generator); + + //Misc + ['Count', 'Unique'].forEach(generator); } } diff --git a/test/apis/promise.js b/test/apis/promise.js index cff650f..4996d51 100644 --- a/test/apis/promise.js +++ b/test/apis/promise.js @@ -464,6 +464,20 @@ describe('Cayley bluebird Promise style Gizmo APIs', function() { }); }); + it('path.V().Count()', function() { + return cayleyClient.g.V().Count().then((res) => { + console.log("Res", JSON.stringify(res,null,2)) + expect(res).to.eq(1) + }) + }) + + it('path.V().Unique()', function() { + return cayleyClient.g.V().Unique().All().then((res) => { + assert.isArray(res.result); + expect(res.result).to.have.length.gt(1); + }); + }); + it('query.GetLimit(size, callback)', function() { return cayleyClient.g.V().GetLimit(1).then((res) => { assert.isArray(res.result);