Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added basic Gremlin test to be expanded on, included it in index of d…

…efault tests
  • Loading branch information...
commit 50056afd9440ce6f679a6e83cc432e106e709efe 1 parent 4824654
Stephen Rivas JR authored
Showing with 43 additions and 0 deletions.
  1. +42 −0 test/gremlin._coffee
  2. +1 −0  test/index._coffee
View
42 test/gremlin._coffee
@@ -0,0 +1,42 @@
+# will be used for testing gremlin script executions
+# as well as validating the return results are as expected
+
+assert = require('assert')
+neo4j = require('..')
+
+db = new neo4j.GraphDatabase 'http://localhost:7474'
+
+# convenience wrapper
+createNode = (name) ->
+ node = db.createNode {name}
+ node.name = name
+ node.toString = -> name
+ node
+
+#create some nodes
+users = for i in [0..6]
+ createNode "gremlinTest#{i}"
+
+# save in parallel
+futures = (user.save() for user in users)
+future _ for future in futures
+
+# convenience aliases
+user0 = users[0]
+user1 = users[1]
+user2 = users[2]
+user3 = users[3]
+user4 = users[4]
+user5 = users[5]
+user6 = users[6]
+
+# test: can query a single user
+results = db.execute """
+ g.v(#{user0.id})
+""", {}, _
+
+assert.ok typeof results, 'object'
+assert.ok typeof results.data.name, 'string' # dislike this because it will throw for the wrong reasons possibly
+assert.equal results.data.name, user0.name
+
+console.log "Single Result Gremlin Test Passed."
View
1  test/index._coffee
@@ -1,2 +1,3 @@
require './crud'
require './cypher'
+require './gremlin'

0 comments on commit 50056af

Please sign in to comment.
Something went wrong with that request. Please try again.