Skip to content
Browse files

Switch test infrastructure to use Mocha!

Much nicer and more robust than the old manual way. =)
  • Loading branch information...
1 parent c4cd2f2 commit 5297a022d03e4114f646f2d17e13a7a311d4115b @aseemk aseemk committed Sep 3, 2012
Showing with 323 additions and 292 deletions.
  1. +3 −2 package.json
  2. +100 −89 test/crud._coffee
  3. +142 −125 test/cypher._coffee
  4. +75 −73 test/gremlin._coffee
  5. +0 −3 test/index._coffee
  6. +3 −0 test/mocha.opts
View
5 package.json
@@ -17,7 +17,8 @@
},
"devDependencies": {
"codo": "~1.5.1",
- "expect.js": "~0.1.2"
+ "expect.js": "~0.1.2",
+ "mocha": "~1.3.0"
},
"engines": {
"node": ">= 0.6"
@@ -27,7 +28,7 @@
"clean": "rm lib/*.js",
"codo": "codo && codo --server",
"postinstall": "npm run build",
- "test": "_coffee test"
+ "test": "mocha"
},
"keywords": [
"neo4j", "graph", "database", "driver", "rest", "api", "client"
View
189 test/crud._coffee
@@ -6,34 +6,111 @@ neo4j = require '..'
db = new neo4j.GraphDatabase 'http://localhost:7474'
+# data we're going to use:
danielData =
name: 'Daniel'
-
aseemData =
name: 'Aseem'
-daniel = db.createNode danielData
-aseem = db.createNode aseemData
-
-expect(daniel).to.be.an 'object'
-expect(daniel.exists).to.be false
-expect(daniel.self).to.be null
- # TODO should this really be tested? is @self a public API?
- # maybe it should just have a better name than the misleading 'self'?
-
-# test futures here by saving both aseem and daniel in parallel:
-futures = [daniel.save(), aseem.save()]
-future _ for future in futures
-
-expect(daniel.exists).to.be true
-expect(daniel.self).to.be.a 'string' # TODO see above
-expect(daniel.self).to.not.equal aseem.self # TODO see above
-expect(daniel.data).to.eql danielData
-
-expect(aseem.exists).to.be true
-expect(aseem.self).to.be.a 'string' # TODO see above
-expect(aseem.self).to.not.equal daniel.self # TODO see above
-expect(aseem.data).to.eql aseemData
+# instances we're going to reuse across tests:
+daniel = null
+aseem = null
+relationship = null
+
+@crud =
+
+ 'create nodes': (_) ->
+ daniel = db.createNode danielData
+ aseem = db.createNode aseemData
+
+ expect(daniel).to.be.an 'object'
+ expect(daniel.exists).to.be false
+ expect(daniel.self).to.be null
+ # TODO should this really be tested? is @self a public API?
+ # maybe it should just have a better name than 'self'? like url?
+
+ 'save nodes': (_) ->
+ # test futures here by saving both aseem and daniel in parallel:
+ futures = [daniel.save(), aseem.save()]
+ future _ for future in futures
+
+ expect(daniel.exists).to.be true
+ expect(daniel.self).to.be.a 'string' # TODO see above
+ expect(daniel.self).to.not.equal aseem.self # TODO see above
+ expect(daniel.data).to.eql danielData
+
+ expect(aseem.exists).to.be true
+ expect(aseem.self).to.be.a 'string' # TODO see above
+ expect(aseem.self).to.not.equal daniel.self # TODO see above
+ expect(aseem.data).to.eql aseemData
+
+ 'create realtionships': (_) ->
+ relationship = daniel.createRelationshipTo aseem, 'follows', {created: Date.now()}, _
+ testRelationship relationship
+
+ # in this case, the start and end *should* be our instances
+ expect(relationship.start).to.be daniel
+ expect(relationship.end).to.be aseem
+
+ 'fetch relationships': (_) ->
+ # test futures by *initiating* getRelationships() for both aseem and daniel in
+ # parallel. note how we'll still "collect" (process) the futures in sequence.
+ danielFuture = daniel.getRelationships('follows')
+ aseemFuture = aseem.getRelationships('follows')
+
+ relationships = danielFuture _
+ testRelationships relationships
+
+ # in this case, the start *should* be our instance
+ expect(relationships[0].start).to.be daniel
+
+ relationships = aseemFuture _
+ testRelationships relationships
+
+ # in this case, the end *should* be our instance
+ expect(relationships[0].end).to.be aseem
+
+ 'traverse nodes': (_) ->
+ # same parallel lookups using futures:
+ danielFuture = daniel.getRelationshipNodes('follows')
+ aseemFuture = aseem.getRelationshipNodes('follows')
+
+ nodes = danielFuture _
+ expect(nodes).to.be.an 'array'
+ expect(nodes).to.have.length 1
+ expect(nodes[0]).to.be.an 'object'
+ expect(nodes[0].exists).to.be true
+ expect(nodes[0].self).to.equal aseem.self # TODO see above
+ expect(nodes[0].data).to.eql aseemData
+
+ # TODO see how this is misleading? we don't respect or report direction!
+ nodes = aseemFuture _
+ expect(nodes).to.be.an 'array'
+ expect(nodes).to.have.length 1
+ expect(nodes[0]).to.be.an 'object'
+ expect(nodes[0].exists).to.be true
+ expect(nodes[0].self).to.equal daniel.self # TODO see above
+ expect(nodes[0].data).to.eql danielData
+
+ 'index nodes': (_) ->
+ daniel.index 'users', 'name', 'Daniel', _
+ node = db.getIndexedNode 'users', 'name', 'Daniel', _
+ expect(node).to.be.an 'object'
+ expect(node.exists).to.be true
+ # TODO FIXME we're not unindexing these nodes after each test, so in fact the
+ # returned node and data might be from a previous test!
+ # expect(node.self).to.equal daniel.self # TODO see above
+ # expect(node.data).to.eql danielData
+
+ 'index relationships': (_) ->
+ relationship.index 'follows', 'name', 'Daniel', _
+ rel = db.getIndexedRelationship 'follows', 'name', 'Daniel', _
+ expect(rel).to.be.an 'object'
+ expect(rel.exists).to.be true
+ expect(rel.self).to.be.a 'string' # TODO see above
+ expect(rel.type).to.be 'follows'
+
+ # TODO delete tests! that's the 'd' in 'crud'!
testRelationship = (relationship) ->
expect(relationship).to.be.an 'object'
@@ -57,69 +134,3 @@ testRelationships = (relationships) ->
expect(relationships).to.be.an 'array'
expect(relationships).to.have.length 1
testRelationship relationships[0]
-
-relationship = daniel.createRelationshipTo aseem, 'follows', {created: Date.now()}, _
-testRelationship relationship
-
-# in this case, the start and end *should* be our instances
-expect(relationship.start).to.be daniel
-expect(relationship.end).to.be aseem
-
-# test futures by *initiating* getRelationships() for both aseem and daniel in
-# parallel. note how we'll still "collect" (process) the futures in sequence.
-danielFuture = daniel.getRelationships('follows')
-aseemFuture = aseem.getRelationships('follows')
-
-relationships = danielFuture _
-testRelationships relationships
-
-# in this case, the start *should* be our instance
-expect(relationships[0].start).to.be daniel
-
-relationships = aseemFuture _
-testRelationships relationships
-
-# in this case, the end *should* be our instance
-expect(relationships[0].end).to.be aseem
-
-# same parallel lookups using futures:
-danielFuture = daniel.getRelationshipNodes('follows')
-aseemFuture = aseem.getRelationshipNodes('follows')
-
-nodes = danielFuture _
-expect(nodes).to.be.an 'array'
-expect(nodes).to.have.length 1
-expect(nodes[0]).to.be.an 'object'
-expect(nodes[0].exists).to.be true
-expect(nodes[0].self).to.equal aseem.self # TODO see above
-expect(nodes[0].data).to.eql aseemData
-
-# TODO see how this is misleading? we don't respect or report direction!
-nodes = aseemFuture _
-expect(nodes).to.be.an 'array'
-expect(nodes).to.have.length 1
-expect(nodes[0]).to.be.an 'object'
-expect(nodes[0].exists).to.be true
-expect(nodes[0].self).to.equal daniel.self # TODO see above
-expect(nodes[0].data).to.eql danielData
-
-daniel.index 'users', 'name', 'Daniel', _
-node = db.getIndexedNode 'users', 'name', 'Daniel', _
-expect(node).to.be.an 'object'
-expect(node.exists).to.be true
-# TODO FIXME we're not unindexing these nodes after each test, so in fact the
-# returned node and data might be from a previous test!
-# expect(node.self).to.equal daniel.self # TODO see above
-# expect(node.data).to.eql danielData
-
-relationship.index 'follows', 'name', 'Daniel', _
-rel = db.getIndexedRelationship 'follows', 'name', 'Daniel', _
-expect(rel).to.be.an 'object'
-expect(rel.exists).to.be true
-expect(rel.self).to.be.a 'string' # TODO see above
-expect(rel.type).to.be 'follows'
-
-# TODO delete tests! that's the 'd' in 'crud'!
-
-# just to ensure that no sorts of silent transformation errors plagued us
-console.log 'passed CRUD tests'
View
267 test/cypher._coffee
@@ -11,10 +11,6 @@ users = for i in [0..9]
db.createNode
name: "user#{i}"
-# save in parallel
-futures = (user.save() for user in users)
-future _ for future in futures
-
# convenience aliases
user0 = users[0]
user1 = users[1]
@@ -27,124 +23,145 @@ user7 = users[7]
user8 = users[8]
user9 = users[9]
-# test: can query a single user
-results = db.query """
- START n=node(#{user0.id})
- RETURN n
-""", _
-expect(results).to.be.an 'array'
-expect(results).to.have.length 1
-expect(results[0]).to.be.an 'object'
-expect(results[0]['n']).to.be.an 'object'
-expect(results[0]['n'].id).to.equal user0.id
-expect(results[0]['n'].data).to.eql user0.data
-
-# test: can query multiple users
-results = db.query """
- START n=node(#{user0.id},#{user1.id},#{user2.id})
- RETURN n
- ORDER BY n.name
-""", _
-expect(results).to.be.an 'array'
-expect(results).to.have.length 3
-expect(results[1]).to.be.an 'object'
-expect(results[1]['n']).to.be.an 'object'
-expect(results[1]['n'].data).to.eql user1.data
-
-# have user0 follow user1, user2 and user3
-# have user1 follow user2, user3 and user4
-# ...
-# have user8 follow user9, user0 and user1
-# have user9 follow user0, user1 and user2
-createFollowRelationships = (i, _) ->
- user = users[i]
- i1 = (i + 1) % users.length
- i2 = (i + 2) % users.length
- i3 = (i + 3) % users.length
- # create three relationships in parallel
- # WARNING: don't use a variable named futures here!
- # coffeescript variable shadowing will kick in unexpectedly. =(
- f1 = user.createRelationshipTo users[i1], 'follows', {}
- f2 = user.createRelationshipTo users[i2], 'follows', {}
- f3 = user.createRelationshipTo users[i3], 'follows', {}
- f1 _
- f2 _
- f3 _
-
-# create follow relationships for each user in parallel
-futures = (createFollowRelationships(i) for user, i in users)
-future _ for future in futures
-
-# test: can query relationships and return multiple values
-results = db.query """
- START n=node(#{user6.id})
- MATCH (n) -[r:follows]-> (m)
- RETURN r, m.name
- ORDER BY m.name
-""", _
-expect(results).to.be.an 'array'
-expect(results).to.have.length 3
-expect(results[1]).to.be.an 'object'
-expect(results[1]['r']).to.be.an 'object'
-expect(results[1]['r'].type).to.be 'follows'
-expect(results[1]['m.name']).to.equal user8.data.name
-
-# test: sending query parameters instead of literals
-results = db.query '''
- START n=node({userId})
- MATCH (n) -[r:follows]-> (m)
- RETURN r, m.name
- ORDER BY m.name
-''', {userId: user3.id}, _
-expect(results).to.be.an 'array'
-expect(results).to.have.length 3
-expect(results[1]).to.be.an 'object'
-expect(results[1]['r']).to.be.an 'object'
-expect(results[1]['r'].type).to.be 'follows'
-expect(results[1]['m.name']).to.equal user5.data.name
-
-# test: can return nodes in an array
-results = db.query """
- START n=node(#{user0.id},#{user1.id},#{user2.id})
- RETURN collect(n)
-""", _
-expect(results).to.be.an 'array'
-expect(results).to.have.length 1
-expect(results[0]).to.be.an 'object'
-expect(results[0]['collect(n)']).to.be.an 'array'
-expect(results[0]['collect(n)']).to.have.length 3
-expect(results[0]['collect(n)'][1]).to.be.an 'object'
-expect(results[0]['collect(n)'][1].id).to.equal user1.id
-expect(results[0]['collect(n)'][1].data).to.eql user1.data
-
-# test: can return paths
-results = db.query """
- START from=node({fromId}), to=node({toId})
- MATCH path=shortestPath(from -[:follows*..3]-> to)
- RETURN path
-""", {fromId: user0.id, toId: user6.id}, _
-# TODO Node and Rel instances in returned Path objects aren't necessarily
-# "filled", so we don't assert equality for those instances' data. it'd be
-# great if future versions of this library fixed that, but is it possible?
-expect(results).to.be.an 'array'
-expect(results).to.have.length 1
-expect(results[0]).to.be.an 'object'
-expect(results[0]['path']).to.be.an 'object'
-expect(results[0]['path'].start).to.be.an 'object'
-expect(results[0]['path'].start.id).to.equal user0.id
-# expect(results[0]['path'].start.data).to.eql user0.data
-expect(results[0]['path'].end).to.be.an 'object'
-expect(results[0]['path'].end.id).to.equal user6.id
-# expect(results[0]['path'].end.data).to.eql user6.data
-expect(results[0]['path'].nodes).to.be.an 'array'
-expect(results[0]['path'].nodes).to.have.length 3
-expect(results[0]['path'].nodes[1]).to.be.an 'object'
-expect(results[0]['path'].nodes[1].id).to.equal user3.id
-# expect(results[0]['path'].nodes[1].data).to.eql user3.data
-expect(results[0]['path'].relationships).to.be.an 'array'
-expect(results[0]['path'].relationships).to.have.length 2
-expect(results[0]['path'].relationships[1]).to.be.an 'object'
-# expect(results[0]['path'].relationships[1].type).to.be 'follows'
-
-# give some confidence that these tests actually passed ;)
-console.log 'passed cypher tests'
+@cypher =
+
+ '(pre-req) save nodes': (_) ->
+ # save in parallel
+ futures = (user.save() for user in users)
+ future _ for future in futures
+
+ 'query single user': (_) ->
+ results = db.query """
+ START n=node(#{user0.id})
+ RETURN n
+ """, _
+
+ expect(results).to.be.an 'array'
+ expect(results).to.have.length 1
+
+ expect(results[0]).to.be.an 'object'
+ expect(results[0]['n']).to.be.an 'object'
+ expect(results[0]['n'].id).to.equal user0.id
+ expect(results[0]['n'].data).to.eql user0.data
+
+ 'query multiple users': (_) ->
+ results = db.query """
+ START n=node(#{user0.id},#{user1.id},#{user2.id})
+ RETURN n
+ ORDER BY n.name
+ """, _
+ expect(results).to.be.an 'array'
+ expect(results).to.have.length 3
+
+ expect(results[1]).to.be.an 'object'
+ expect(results[1]['n']).to.be.an 'object'
+ expect(results[1]['n'].data).to.eql user1.data
+
+ '(pre-req) create relationships': (_) ->
+ # have user0 follow user1, user2 and user3
+ # have user1 follow user2, user3 and user4
+ # ...
+ # have user8 follow user9, user0 and user1
+ # have user9 follow user0, user1 and user2
+ createFollowRelationships = (i, _) ->
+ user = users[i]
+ i1 = (i + 1) % users.length
+ i2 = (i + 2) % users.length
+ i3 = (i + 3) % users.length
+ # create three relationships in parallel
+ # WARNING: don't use a variable named futures here!
+ # coffeescript variable shadowing will kick in unexpectedly. =(
+ f1 = user.createRelationshipTo users[i1], 'follows', {}
+ f2 = user.createRelationshipTo users[i2], 'follows', {}
+ f3 = user.createRelationshipTo users[i3], 'follows', {}
+ f1 _
+ f2 _
+ f3 _
+
+ # create follow relationships for each user in parallel
+ futures = (createFollowRelationships(i) for user, i in users)
+ future _ for future in futures
+
+ 'query relationships / return multiple values': (_) ->
+ results = db.query """
+ START n=node(#{user6.id})
+ MATCH (n) -[r:follows]-> (m)
+ RETURN r, m.name
+ ORDER BY m.name
+ """, _
+
+ expect(results).to.be.an 'array'
+ expect(results).to.have.length 3
+
+ expect(results[1]).to.be.an 'object'
+ expect(results[1]['r']).to.be.an 'object'
+ expect(results[1]['r'].type).to.be 'follows'
+ expect(results[1]['m.name']).to.equal user8.data.name
+
+ 'send query parameters instead of literals': (_) ->
+ results = db.query '''
+ START n=node({userId})
+ MATCH (n) -[r:follows]-> (m)
+ RETURN r, m.name
+ ORDER BY m.name
+ ''', {userId: user3.id}, _
+
+ expect(results).to.be.an 'array'
+ expect(results).to.have.length 3
+
+ expect(results[1]).to.be.an 'object'
+ expect(results[1]['r']).to.be.an 'object'
+ expect(results[1]['r'].type).to.be 'follows'
+ expect(results[1]['m.name']).to.equal user5.data.name
+
+ 'return collection/array of nodes': (_) ->
+ results = db.query """
+ START n=node(#{user0.id},#{user1.id},#{user2.id})
+ RETURN collect(n)
+ """, _
+
+ expect(results).to.be.an 'array'
+ expect(results).to.have.length 1
+
+ expect(results[0]).to.be.an 'object'
+ expect(results[0]['collect(n)']).to.be.an 'array'
+ expect(results[0]['collect(n)']).to.have.length 3
+ expect(results[0]['collect(n)'][1]).to.be.an 'object'
+ expect(results[0]['collect(n)'][1].id).to.equal user1.id
+ expect(results[0]['collect(n)'][1].data).to.eql user1.data
+
+ 'return paths': (_) ->
+ results = db.query """
+ START from=node({fromId}), to=node({toId})
+ MATCH path=shortestPath(from -[:follows*..3]-> to)
+ RETURN path
+ """, {fromId: user0.id, toId: user6.id}, _
+
+ # TODO Node and Rel instances in returned Path objects aren't necessarily
+ # "filled", so we don't assert equality for those instances' data. it'd be
+ # great if future versions of this library fixed that, but is it possible?
+
+ expect(results).to.be.an 'array'
+ expect(results).to.have.length 1
+
+ expect(results[0]).to.be.an 'object'
+ expect(results[0]['path']).to.be.an 'object'
+
+ expect(results[0]['path'].start).to.be.an 'object'
+ expect(results[0]['path'].start.id).to.equal user0.id
+ # expect(results[0]['path'].start.data).to.eql user0.data
+
+ expect(results[0]['path'].end).to.be.an 'object'
+ expect(results[0]['path'].end.id).to.equal user6.id
+ # expect(results[0]['path'].end.data).to.eql user6.data
+
+ expect(results[0]['path'].nodes).to.be.an 'array'
+ expect(results[0]['path'].nodes).to.have.length 3
+ expect(results[0]['path'].nodes[1]).to.be.an 'object'
+ expect(results[0]['path'].nodes[1].id).to.equal user3.id
+ # expect(results[0]['path'].nodes[1].data).to.eql user3.data
+
+ expect(results[0]['path'].relationships).to.be.an 'array'
+ expect(results[0]['path'].relationships).to.have.length 2
+ expect(results[0]['path'].relationships[1]).to.be.an 'object'
+ # expect(results[0]['path'].relationships[1].type).to.be 'follows'
View
148 test/gremlin._coffee
@@ -11,10 +11,6 @@ users = for i in [0..6]
db.createNode
name: "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]
@@ -24,72 +20,78 @@ user4 = users[4]
user5 = users[5]
user6 = users[6]
-# test: can query a single user, using param
-result = db.execute """
- g.v(userId)
-""", {userId: user0.id}, _
-expect(result).to.be.an 'object'
-expect(result.id).to.equal user0.id
-expect(result.data).to.eql user0.data
-
-# test: create relationships between users (same as cypher tests),
-# then query by relationships
-createFollowRelationships = (i, _) ->
- user = users[i]
- i1 = (i + 1) % users.length
- i2 = (i + 2) % users.length
- i3 = (i + 3) % users.length
- f1 = user.createRelationshipTo users[i1], 'gremlin_follows', {}
- f2 = user.createRelationshipTo users[i2], 'gremlin_follows', {}
- f3 = user.createRelationshipTo users[i3], 'gremlin_follows', {}
- f1 _
- f2 _
- f3 _
-
-# create follow relationships for each user in parallel
-futures = (createFollowRelationships(i) for user, i in users)
-future _ for future in futures
-
-# TODO this actually returns adjacent nodes, not relationships:
-rels = db.execute """
- g.v(#{user0.id}).in('gremlin_follows')
-""", {}, _
-
-expect(rels).to.be.an 'array'
-expect(rels).to.have.length 3
-expect(rels[1]).to.be.an 'object'
-# order isn't specified/guaranteed; TODO can we specify it?
-expect([user4.id, user5.id, user6.id]).to.contain rels[1].id
-
-# handle multiple types of data return
-traversals = db.execute """
- g.v(#{user0.id}).transform{ [it, it.out.toList(), it.in.count()] }
-""", {}, _
-
-expect(traversals).to.be.an 'array'
-expect(traversals).to.have.length 1
-
-expect(traversals[0]).to.be.an 'array'
-expect(traversals[0]).to.have.length 3
-
-expect(traversals[0][0]).to.be.an 'object'
-expect(traversals[0][0].id).to.equal user0.id
-expect(traversals[0][0].data).to.eql user0.data
-expect(traversals[0][1]).to.be.an 'array'
-expect(traversals[0][1]).to.have.length 3
-expect(traversals[0][1][1]).to.be.an 'object'
-# order isn't specified/guaranteed again; TODO can we specify it?
-expect([user1.id, user2.id, user3.id]).to.contain traversals[0][1][1].id
-expect(traversals[0][2]).to.equal 3
-
-# ensure you can call without params arg
-params_test = db.execute """
- g.v(#{user0.id})
-""", _
-
-expect(params_test).to.be.an 'object'
-expect(params_test.id).to.equal user0.id
-expect(params_test.data).to.eql user0.data
-
-# give some confidence that these tests actually passed ;)
-console.log 'passed gremlin tests'
+@gremlin =
+
+ '(pre-req) save nodes': (_) ->
+ # save in parallel
+ futures = (user.save() for user in users)
+ future _ for future in futures
+
+ 'query single user, using param': (_) ->
+ result = db.execute """
+ g.v(userId)
+ """, {userId: user0.id}, _
+
+ expect(result).to.be.an 'object'
+ expect(result.id).to.equal user0.id
+ expect(result.data).to.eql user0.data
+
+ '(pre-req) create relationships': (_) ->
+ createFollowRelationships = (i, _) ->
+ user = users[i]
+ i1 = (i + 1) % users.length
+ i2 = (i + 2) % users.length
+ i3 = (i + 3) % users.length
+ f1 = user.createRelationshipTo users[i1], 'gremlin_follows', {}
+ f2 = user.createRelationshipTo users[i2], 'gremlin_follows', {}
+ f3 = user.createRelationshipTo users[i3], 'gremlin_follows', {}
+ f1 _
+ f2 _
+ f3 _
+
+ # create follow relationships for each user in parallel
+ futures = (createFollowRelationships(i) for user, i in users)
+ future _ for future in futures
+
+ # TODO test returning relationships too, not just connected nodes
+
+ 'query connected nodes': (_) ->
+ rels = db.execute """
+ g.v(#{user0.id}).in('gremlin_follows')
+ """, {}, _
+
+ expect(rels).to.be.an 'array'
+ expect(rels).to.have.length 3
+ expect(rels[1]).to.be.an 'object'
+ # order isn't specified/guaranteed; TODO can we specify it?
+ expect([user4.id, user5.id, user6.id]).to.contain rels[1].id
+
+ 'return multiple types': (_) ->
+ traversals = db.execute """
+ g.v(#{user0.id}).transform{ [it, it.out.toList(), it.in.count()] }
+ """, {}, _
+
+ expect(traversals).to.be.an 'array'
+ expect(traversals).to.have.length 1
+
+ expect(traversals[0]).to.be.an 'array'
+ expect(traversals[0]).to.have.length 3
+
+ expect(traversals[0][0]).to.be.an 'object'
+ expect(traversals[0][0].id).to.equal user0.id
+ expect(traversals[0][0].data).to.eql user0.data
+ expect(traversals[0][1]).to.be.an 'array'
+ expect(traversals[0][1]).to.have.length 3
+ expect(traversals[0][1][1]).to.be.an 'object'
+ # order isn't specified/guaranteed again; TODO can we specify it?
+ expect([user1.id, user2.id, user3.id]).to.contain traversals[0][1][1].id
+ expect(traversals[0][2]).to.equal 3
+
+ 'query without params arg': (_) ->
+ params_test = db.execute """
+ g.v(#{user0.id})
+ """, _
+
+ expect(params_test).to.be.an 'object'
+ expect(params_test.id).to.equal user0.id
+ expect(params_test.data).to.eql user0.data
View
3 test/index._coffee
@@ -1,3 +0,0 @@
-require './crud'
-require './cypher'
-require './gremlin'
View
3 test/mocha.opts
@@ -0,0 +1,3 @@
+--compilers coffee:coffee-script,_coffee:streamline/register
+-u exports
+-R spec

0 comments on commit 5297a02

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