|
19 | 19 |
|
20 | 20 | var path = require('path'); |
21 | 21 | var os = require('os'); |
22 | | -var neo4jReq = require(path.join(os.tmpdir(), 'sandbox', 'node_modules', 'neo4j-driver', 'lib')); |
| 22 | +var NodeChannel = require('../../lib/v1/internal/ch-node').default; |
23 | 23 |
|
24 | 24 | describe('Package', function() { |
25 | | - |
26 | | - var driverGlobal, originalTimeout; |
27 | | - |
28 | | - beforeAll(function () { |
29 | | - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; |
30 | | - jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; |
31 | | - |
32 | | - var neo4j = neo4jReq.v1; |
33 | | - driverGlobal = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "neo4j")); |
34 | | - }); |
35 | | - |
| 25 | + var driverGlobal = {close: function() {}}; |
36 | 26 | afterAll(function() { |
37 | | - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; |
38 | 27 | driverGlobal.close(); |
39 | 28 | }); |
40 | 29 |
|
41 | 30 | it('should work', function(done){ |
| 31 | + var neo4jReq; |
| 32 | + // Assuming we only run this test on NodeJS |
| 33 | + if( !NodeChannel.available ) { |
| 34 | + done(); |
| 35 | + return; |
| 36 | + } |
| 37 | + |
| 38 | + try { |
| 39 | + neo4jReq = require(path.join(os.tmpdir(), 'sandbox', 'node_modules', 'neo4j-driver', 'lib')); |
| 40 | + } catch(e) { |
| 41 | + done.fail('Could not load sandbox package') |
| 42 | + } |
| 43 | + |
| 44 | + driverGlobal = neo4jReq.v1.driver("bolt://localhost", neo4jReq.v1.auth.basic("neo4j", "neo4j")); |
42 | 45 | var session = driverGlobal.session(); |
43 | 46 | session.run('RETURN 1 AS answer').then(function(result) { |
44 | 47 | expect(result.records.length).toBe(1); |
|
0 commit comments