Skip to content

Commit ca002c5

Browse files
author
Zhen Li
committed
Removing tck to normal unit tests
1 parent a59e8a7 commit ca002c5

File tree

8 files changed

+74
-522
lines changed

8 files changed

+74
-522
lines changed

gulpfile.babel.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ var fs = require("fs-extra");
3636
var runSequence = require('run-sequence');
3737
var path = require('path');
3838
var minimist = require('minimist');
39-
var cucumber = require('gulp-cucumber');
4039
var install = require("gulp-install");
4140
var file = require('gulp-file');
4241
var semver = require('semver');
@@ -153,7 +152,7 @@ gulp.task('install-driver-into-sandbox', ['nodejs'], function(){
153152
});
154153

155154
gulp.task('test', function (cb) {
156-
runSequence('run-ts-declaration-tests', 'test-nodejs', 'test-browser', 'run-tck', function (err) {
155+
runSequence('run-ts-declaration-tests', 'test-nodejs', 'test-browser', function (err) {
157156
if (err) {
158157
var exitCode = 2;
159158
console.log('[FAIL] test task failed - exiting with code ' + exitCode);
@@ -213,23 +212,6 @@ gulp.task('watch-n-test', ['test-nodejs'], function () {
213212
return gulp.watch(['src/**/*.js', "test/**/*.js"], ['test-nodejs'] );
214213
});
215214

216-
var featureFiles = 'https://s3-eu-west-1.amazonaws.com/remoting.neotechnology.com/driver-compliance/tck.tar.gz';
217-
var featureHome = './build/tck';
218-
219-
gulp.task('download-tck', function() {
220-
return download(featureFiles)
221-
.pipe(decompress({strip: 1}))
222-
.pipe(gulp.dest(featureHome));
223-
});
224-
225-
gulp.task('run-tck', ['download-tck', 'nodejs'], function() {
226-
return gulp.src(featureHome + "/*").pipe(cucumber({
227-
'steps': 'test/v1/tck/steps/*.js',
228-
'format': 'progress',
229-
'tags' : ['~@fixed_session_pool', '~@db', '~@equality', '~@streaming_and_cursor_navigation']
230-
})).on('end', logActiveNodeHandles);
231-
});
232-
233215
/** Set the project version, controls package.json and version.js */
234216
gulp.task('set', function() {
235217
// Get the --version arg from command line

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"start-neo4j": "gulp start-neo4j",
1515
"stop-neo4j": "gulp stop-neo4j",
1616
"run-stress-tests": "gulp run-stress-tests",
17-
"run-tck": "gulp run-tck",
1817
"run-ts-declaration-tests": "gulp run-ts-declaration-tests",
1918
"docs": "esdoc -c esdoc.json",
2019
"versionRelease": "gulp set --version $VERSION && npm version $VERSION --no-git-tag-version",

test/v1/session.test.js

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,6 @@ describe('session', () => {
234234
});
235235

236236
it('should expose server info on successful query', done => {
237-
if (!serverIs31OrLater(done)) {
238-
return;
239-
}
240-
241237
// Given
242238
const statement = 'RETURN 1';
243239

@@ -252,11 +248,7 @@ describe('session', () => {
252248
});
253249
});
254250

255-
it('should expose execution time information when using 3.1 and onwards', done => {
256-
if (!serverIs31OrLater(done)) {
257-
return;
258-
}
259-
251+
it('should expose execution time information', done => {
260252
// Given
261253
const statement = 'UNWIND range(1,10000) AS n RETURN n AS number';
262254
// When & Then
@@ -359,7 +351,8 @@ describe('session', () => {
359351
session.beginTransaction();
360352

361353
// Then
362-
expect(session.beginTransaction).toThrow();
354+
expect(session.beginTransaction).toThrowError(
355+
/You cannot begin a transaction on a session with an open transaction/);
363356
});
364357

365358
it('should return lots of data', done => {
@@ -579,9 +572,6 @@ describe('session', () => {
579572
});
580573

581574
it('should update last bookmark after every read tx commit', done => {
582-
if (!serverIs31OrLater(done)) {
583-
return;
584-
}
585575

586576
// new session without initial bookmark
587577
session = driver.session();
@@ -601,9 +591,6 @@ describe('session', () => {
601591
});
602592

603593
it('should update last bookmark after every write tx commit', done => {
604-
if (!serverIs31OrLater(done)) {
605-
return;
606-
}
607594

608595
const bookmarkBefore = session.lastBookmark();
609596

@@ -621,9 +608,6 @@ describe('session', () => {
621608
});
622609

623610
it('should not lose last bookmark after run', done => {
624-
if (!serverIs31OrLater(done)) {
625-
return;
626-
}
627611

628612
const tx = session.beginTransaction();
629613
tx.run('CREATE ()').then(() => {
@@ -640,10 +624,6 @@ describe('session', () => {
640624
});
641625

642626
it('should commit read transaction', done => {
643-
if (!serverIs31OrLater(done)) {
644-
return;
645-
}
646-
647627
// new session without initial bookmark
648628
session = driver.session();
649629
expect(session.lastBookmark()).toBeNull();
@@ -659,10 +639,6 @@ describe('session', () => {
659639
});
660640

661641
it('should commit write transaction', done => {
662-
if (!serverIs31OrLater(done)) {
663-
return;
664-
}
665-
666642
const bookmarkBefore = session.lastBookmark();
667643
const resultPromise = session.writeTransaction(tx => tx.run('CREATE (n:Node {id: 42}) RETURN n.id AS answer'));
668644

@@ -683,10 +659,6 @@ describe('session', () => {
683659
});
684660

685661
it('should not commit already committed read transaction', done => {
686-
if (!serverIs31OrLater(done)) {
687-
return;
688-
}
689-
690662
const resultPromise = session.readTransaction(tx => {
691663
return new Promise((resolve, reject) => {
692664
tx.run('RETURN 42 AS answer').then(result => {
@@ -712,10 +684,6 @@ describe('session', () => {
712684
});
713685

714686
it('should not commit already committed write transaction', done => {
715-
if (!serverIs31OrLater(done)) {
716-
return;
717-
}
718-
719687
const resultPromise = session.readTransaction(tx => {
720688
return new Promise((resolve, reject) => {
721689
tx.run('CREATE (n:Node {id: 42}) RETURN n.id AS answer').then(result => {
@@ -745,9 +713,6 @@ describe('session', () => {
745713
});
746714

747715
it('should not commit rolled back read transaction', done => {
748-
if (!serverIs31OrLater(done)) {
749-
return;
750-
}
751716

752717
const bookmarkBefore = session.lastBookmark();
753718
const resultPromise = session.readTransaction(tx => {
@@ -770,9 +735,6 @@ describe('session', () => {
770735
});
771736

772737
it('should not commit rolled back write transaction', done => {
773-
if (!serverIs31OrLater(done)) {
774-
return;
775-
}
776738

777739
const bookmarkBefore = session.lastBookmark();
778740
const resultPromise = session.readTransaction(tx => {
@@ -799,10 +761,6 @@ describe('session', () => {
799761
});
800762

801763
it('should interrupt query waiting on a lock when closed', done => {
802-
if (!serverIs31OrLater(done)) {
803-
// locks are transaction termination aware by default only in 3.1+
804-
return;
805-
}
806764

807765
session.run('CREATE ()').then(() => {
808766
session.close(() => {
@@ -836,10 +794,6 @@ describe('session', () => {
836794
});
837795

838796
it('should interrupt transaction waiting on a lock when closed', done => {
839-
if (!serverIs31OrLater(done)) {
840-
// locks are transaction termination aware by default only in 3.1+
841-
return;
842-
}
843797

844798
session.run('CREATE ()').then(() => {
845799
session.close(() => {
@@ -874,10 +828,6 @@ describe('session', () => {
874828
});
875829

876830
it('should interrupt transaction function waiting on a lock when closed', done => {
877-
if (!serverIs31OrLater(done)) {
878-
// locks are transaction termination aware by default only in 3.1+
879-
return;
880-
}
881831

882832
session.run('CREATE ()').then(() => {
883833
session.close(() => {
@@ -1163,16 +1113,6 @@ describe('session', () => {
11631113
});
11641114
}
11651115

1166-
function serverIs31OrLater(done) {
1167-
if (serverVersion.compareTo(VERSION_3_1_0) < 0) {
1168-
if (done && typeof done === 'function') {
1169-
done();
1170-
}
1171-
return false;
1172-
}
1173-
return true;
1174-
}
1175-
11761116
function countNodes(label, propertyKey, propertyValue) {
11771117
return new Promise((resolve, reject) => {
11781118
session.run(`MATCH (n: ${label} {${propertyKey}: ${propertyValue}}) RETURN count(n) AS count`).then(result => {

test/v1/summary.test.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/**
2+
* Copyright (c) 2002-2019 "Neo4j,"
3+
* Neo4j Sweden AB [http://neo4j.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+
import neo4j from '../../src/v1';
21+
import sharedNeo4j from '../internal/shared-neo4j';
22+
23+
describe('result summary', () => {
24+
25+
let driver, session;
26+
27+
beforeEach(done => {
28+
driver = neo4j.driver('bolt://localhost', sharedNeo4j.authToken);
29+
session = driver.session();
30+
31+
session.run("MATCH (n) DETACH DELETE n").then(done);
32+
});
33+
34+
afterEach(() => {
35+
driver.close();
36+
});
37+
38+
fit('should get result summary', done => {
39+
// When & Then
40+
session.run("CREATE (p:Person { Name: 'Test'})").then(result => {
41+
var summary = result.summary;
42+
43+
expect(summary.statement.text).toBe("CREATE (p:Person { Name: 'Test'})");
44+
expect(summary.statement.parameters).toEqual({});
45+
46+
expect(summary.statementType).toBe("w");
47+
expect(summary.plan).toBe(false);
48+
expect(summary.profile).toBe(false);
49+
expect(summary.notifications).toEqual([]);
50+
expect(summary.resultConsumedAfter).toBeDefined();
51+
expect(summary.resultAvailableAfter).toBeDefined();
52+
53+
var counters = summary.counters;
54+
expect(counters.nodesCreated()).toBe(1);
55+
expect(counters.nodesDeleted()).toBe(0);
56+
expect(counters.relationshipsCreated()).toBe(0);
57+
expect(counters.relationshipsDeleted()).toBe(0);
58+
expect(counters.propertiesSet()).toBe(1);
59+
expect(counters.labelsAdded()).toBe(1);
60+
expect(counters.labelsRemoved()).toBe(0);
61+
expect(counters.indexesAdded()).toBe(0);
62+
expect(counters.indexesRemoved()).toBe(0);
63+
expect(counters.constraintsAdded()).toBe(0);
64+
expect(counters.constraintsRemoved()).toBe(0);
65+
done();
66+
});
67+
});
68+
});

test/v1/tck/steps/authsteps.js

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)