Skip to content

Commit 8724a75

Browse files
committed
Test driver package in sandbox
1 parent e6c5ce1 commit 8724a75

File tree

4 files changed

+68
-1
lines changed

4 files changed

+68
-1
lines changed

gulpfile.babel.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ var childProcess = require("child_process");
4444
var minimist = require('minimist');
4545
var cucumber = require('gulp-cucumber');
4646
var merge = require('merge-stream');
47+
var install = require("gulp-install");
48+
var rename = require("gulp-rename");
4749

4850
gulp.task('default', ["test"]);
4951

@@ -131,8 +133,15 @@ gulp.task('all', function(cb){
131133
runSequence('nodejs', 'browser', cb);
132134
});
133135

136+
gulp.task('install-driver-into-sandbox', ['nodejs'], function(){
137+
return gulp.src('./test/resources/test-package.json')
138+
.pipe(rename('package.json'))
139+
.pipe(gulp.dest('./build/sandbox'))
140+
.pipe(install())
141+
})
142+
134143
gulp.task('test', function(cb){
135-
runSequence('test-nodejs', 'test-browser', 'run-tck', function (err) {
144+
runSequence('install-driver-into-sandbox', 'test-nodejs', 'test-browser', 'run-tck', function (err) {
136145
if (err) {
137146
var exitCode = 2;
138147
console.log('[FAIL] test task failed - exiting with code ' + exitCode);

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@
3737
"gulp-decompress": "^1.2.0",
3838
"gulp-download": "^0.0.1",
3939
"gulp-if": "^1.2.5",
40+
"gulp-install": "^0.6.0",
4041
"gulp-jasmine": "^2.1.0",
4142
"gulp-jasmine-browser": "^0.2.3",
43+
"gulp-rename": "^1.2.2",
4244
"gulp-replace": "^0.5.4",
4345
"gulp-shell": "^0.4.3",
4446
"gulp-uglify": "^1.4.2",

test/resources/test-package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dependencies": {
3+
"neo4j-driver": "file:../../"
4+
}
5+
}

test/v1/package.test.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* Copyright (c) 2002-2016 "Neo Technology,"
3+
* Network Engine for Objects in Lund AB [http://neotechnology.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
var neo4jv1 = require("../../build/sandbox/node_modules/neo4j-driver/lib/v1");
21+
22+
describe('Package', function() {
23+
var driverGlobal, originalTimeout;
24+
beforeAll(function () {
25+
var neo4j = neo4jv1;
26+
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
27+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
28+
29+
//tag::construct-driver[]
30+
var driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "neo4j"));
31+
//end::construct-driver[]
32+
driverGlobal = driver;
33+
});
34+
afterAll(function() {
35+
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
36+
driverGlobal.close();
37+
});
38+
39+
fit('should work work', function(done){
40+
var session = driverGlobal.session();
41+
session.run('RETURN 1').then(function(r) {
42+
expect(1).toBe(1);
43+
session.close();
44+
done();
45+
}).catch(function(e) {
46+
console.log(e)
47+
expect(1).toBe(2);
48+
done();
49+
})
50+
})
51+
})

0 commit comments

Comments
 (0)