Skip to content

Commit bc8f31e

Browse files
committed
Print error when it does not match expectations
1 parent bdc3de3 commit bc8f31e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/v1/bolt-v3.test.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,13 @@ describe('Bolt V3 API', () => {
9292
session.run('MATCH (n:Node) SET n.prop = $newValue', {newValue: 2}, {timeout: 1})
9393
.then(() => done.fail('Failure expected'))
9494
.catch(error => {
95-
expect(error.code.indexOf('TransientError')).toBeGreaterThan(0);
96-
expect(error.message.indexOf('transaction has been terminated')).toBeGreaterThan(0);
95+
const hasExpectedCode = error.code.indexOf('TransientError') !== -1;
96+
const hasExpectedMessage = error.message.indexOf('transaction has been terminated') !== -1;
97+
if (!hasExpectedCode || !hasExpectedMessage) {
98+
console.log(`Unexpected error with code ${error.code}`, error);
99+
}
100+
expect(hasExpectedCode).toBeTruthy();
101+
expect(hasExpectedMessage).toBeTruthy();
97102

98103
tx.rollback()
99104
.then(() => otherSession.close())

0 commit comments

Comments
 (0)