Skip to content

Commit 00f7eb0

Browse files
committed
Fix expectation to work with 4.0
1 parent 618fd25 commit 00f7eb0

File tree

3 files changed

+43
-6
lines changed

3 files changed

+43
-6
lines changed

gulpfile.babel.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,25 +181,37 @@ gulp.task('run-browser-test', function(cb){
181181
gulp.task('run-browser-test-chrome', function(cb){
182182
new karmaServer({
183183
configFile: __dirname + '/test/browser/karma-chrome.conf.js',
184-
}, cb).start();
184+
singleRun: true,
185+
}, function (exitCode) {
186+
exitCode ? process.exit(exitCode) : cb();
187+
}).start();
185188
});
186189

187190
gulp.task('run-browser-test-firefox', function(cb){
188191
new karmaServer({
189192
configFile: __dirname + '/test/browser/karma-firefox.conf.js',
190-
}, cb).start();
193+
singleRun: true,
194+
}, function (exitCode) {
195+
exitCode ? process.exit(exitCode) : cb();
196+
}).start();
191197
});
192198

193199
gulp.task('run-browser-test-edge', function(cb){
194200
new karmaServer({
195201
configFile: __dirname + '/test/browser/karma-edge.conf.js',
196-
}, cb).start();
202+
singleRun: true,
203+
}, function (exitCode) {
204+
exitCode ? process.exit(exitCode) : cb();
205+
}).start();
197206
});
198207

199208
gulp.task('run-browser-test-ie', function (cb) {
200209
new karmaServer({
201210
configFile: __dirname + '/test/browser/karma-ie.conf.js',
202-
}, cb).start();
211+
singleRun: true,
212+
}, function (exitCode) {
213+
exitCode ? process.exit(exitCode) : cb();
214+
}).start();
203215
});
204216

205217
gulp.task('watch', function () {

test/internal/http/http-driver.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ describe('http driver', () => {
3030
let serverVersion;
3131

3232
beforeEach(async () => {
33+
jasmine.addMatchers(testUtils.matchers);
34+
3335
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
3436
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
3537

@@ -253,7 +255,7 @@ describe('http driver', () => {
253255
} catch (error) {
254256
failed = true;
255257
expect(error.name).toEqual('Neo4jError');
256-
expect(error.code).toEqual('Neo.DatabaseError.Statement.ExecutionFailed');
258+
expect(error.code).toBeElementOf(['Neo.DatabaseError.Statement.ExecutionFailed', 'Neo.TransientError.Transaction.LockClientStopped']);
257259
expect(error.message.indexOf('transaction has been terminated')).not.toBeLessThan(0);
258260
}
259261

test/internal/test-utils.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,31 @@ function fakeStandardDateWithOffset(offsetMinutes) {
3030
return date;
3131
}
3232

33+
const matchers = {
34+
toBeElementOf: function (util, customEqualityTesters) {
35+
return {
36+
compare: function(actual, expected) {
37+
if (expected === undefined) {
38+
expected = [];
39+
}
40+
41+
let result = {};
42+
43+
result.pass = util.contains(expected, actual);
44+
if (result.pass) {
45+
result.message = `Expected '${actual}' to be an element of '[${expected}]'`;
46+
} else {
47+
result.message = `Expected '${actual}' to be an element of '[${expected}]', but it wasn't`;
48+
}
49+
return result;
50+
}
51+
}
52+
}
53+
};
54+
3355
export default {
3456
isClient,
3557
isServer,
36-
fakeStandardDateWithOffset
58+
fakeStandardDateWithOffset,
59+
matchers
3760
};

0 commit comments

Comments
 (0)