Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 2 changed files with 43 additions and 0 deletions. Show diff stats Hide diff stats

  1. +42 0 test/gremlin._coffee
  2. +1 0  test/index._coffee
42 test/gremlin._coffee
... ... @@ -0,0 +1,42 @@
  1 +# will be used for testing gremlin script executions
  2 +# as well as validating the return results are as expected
  3 +
  4 +assert = require('assert')
  5 +neo4j = require('..')
  6 +
  7 +db = new neo4j.GraphDatabase 'http://localhost:7474'
  8 +
  9 +# convenience wrapper
  10 +createNode = (name) ->
  11 + node = db.createNode {name}
  12 + node.name = name
  13 + node.toString = -> name
  14 + node
  15 +
  16 +#create some nodes
  17 +users = for i in [0..6]
  18 + createNode "gremlinTest#{i}"
  19 +
  20 +# save in parallel
  21 +futures = (user.save() for user in users)
  22 +future _ for future in futures
  23 +
  24 +# convenience aliases
  25 +user0 = users[0]
  26 +user1 = users[1]
  27 +user2 = users[2]
  28 +user3 = users[3]
  29 +user4 = users[4]
  30 +user5 = users[5]
  31 +user6 = users[6]
  32 +
  33 +# test: can query a single user
  34 +results = db.execute """
  35 + g.v(#{user0.id})
  36 +""", {}, _
  37 +
  38 +assert.ok typeof results, 'object'
  39 +assert.ok typeof results.data.name, 'string' # dislike this because it will throw for the wrong reasons possibly
  40 +assert.equal results.data.name, user0.name
  41 +
  42 +console.log "Single Result Gremlin Test Passed."
1  test/index._coffee
... ... @@ -1,2 +1,3 @@
1 1 require './crud'
2 2 require './cypher'
  3 +require './gremlin'

0 comments on commit 50056af

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