Skip to content

Commit dca6185

Browse files
authored
Merge pull request #484 from ali-ince/4.0-fix-notification-tests
Use another statement for cypher notification tests
2 parents b8a737b + 039b7e5 commit dca6185

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

test/rx/summary.test.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -560,27 +560,25 @@ describe('#integration-rx summary', () => {
560560
* @param {RxSession|RxTransaction} runnable
561561
*/
562562
async function shouldReturnNotification (version, runnable) {
563-
pending('seems to be flaky')
564-
565563
if (version.compareTo(VERSION_4_0_0) < 0) {
566564
return
567565
}
568566

569567
const summary = await runnable
570-
.run('CYPHER runtime=interpreted EXPLAIN MATCH (n),(m) RETURN n,m')
568+
.run('EXPLAIN MATCH (n:ThisLabelDoesNotExist) RETURN n')
571569
.summary()
572570
.toPromise()
573571
expect(summary).toBeDefined()
574572
expect(summary.notifications).toBeTruthy()
575573
expect(summary.notifications.length).toBeGreaterThan(0)
576574
expect(summary.notifications[0].code).toBe(
577-
'Neo.ClientNotification.Statement.CartesianProductWarning'
575+
'Neo.ClientNotification.Statement.UnknownLabelWarning'
578576
)
579577
expect(summary.notifications[0].title).toBe(
580-
'This query builds a cartesian product between disconnected patterns.'
578+
'The provided label is not in the database.'
581579
)
582580
expect(summary.notifications[0].description).toBe(
583-
'If a part of a query contains multiple disconnected patterns, this will build a cartesian product between all those parts. This may produce a large amount of data and slow down query processing. While occasionally intended, it may often be possible to reformulate the query that avoids the use of this cross product, perhaps by adding a relationship between the different parts or by using OPTIONAL MATCH (identifier is: (m))'
581+
'One of the labels in your query is not available in the database, make sure you didn\'t misspell it or that the label is available when you run this statement in your application (the missing label name is: ThisLabelDoesNotExist)'
584582
)
585583
expect(summary.notifications[0].severity).toBe('WARNING')
586584
}

test/session.test.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -304,21 +304,17 @@ describe('#integration session', () => {
304304
})
305305

306306
it('should expose cypher notifications ', done => {
307-
if (serverVersion.compareTo(VERSION_4_0_0) >= 0) {
308-
pending('seems to be flaky')
309-
}
310-
311307
// Given
312-
const statement = 'EXPLAIN MATCH (n), (m) RETURN n, m'
308+
const statement = 'EXPLAIN MATCH (n:ThisLabelDoesNotExist) RETURN n'
313309
// When & Then
314310
session.run(statement).then(result => {
315311
const sum = result.summary
316312
expect(sum.notifications.length).toBeGreaterThan(0)
317313
expect(sum.notifications[0].code).toBe(
318-
'Neo.ClientNotification.Statement.CartesianProductWarning'
314+
'Neo.ClientNotification.Statement.UnknownLabelWarning'
319315
)
320316
expect(sum.notifications[0].title).toBe(
321-
'This query builds a cartesian product between disconnected patterns.'
317+
'The provided label is not in the database.'
322318
)
323319
expect(sum.notifications[0].position.column).toBeGreaterThan(0)
324320
done()
@@ -1314,9 +1310,7 @@ describe('#integration session', () => {
13141310
.run('RETURN $value', { value: value })
13151311
.then(() => {
13161312
done.fail(
1317-
`Should not be possible to send ${
1318-
value.constructor.name
1319-
} ${value} as a query parameter`
1313+
`Should not be possible to send ${value.constructor.name} ${value} as a query parameter`
13201314
)
13211315
})
13221316
.catch(error => {

test/summary.test.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ describe('#integration result summary', () => {
4848
})
4949

5050
it('should get notifications from summary', done => {
51-
verifyNotifications(session, 'EXPLAIN MATCH (n), (m) RETURN n, m', done)
51+
verifyNotifications(
52+
session,
53+
'EXPLAIN MATCH (n:ThisLabelDoesNotExist) RETURN n',
54+
done
55+
)
5256
})
5357
})
5458

@@ -81,7 +85,11 @@ describe('#integration result summary', () => {
8185
})
8286

8387
it('should get notifications from summary', done => {
84-
verifyNotifications(session, 'EXPLAIN MATCH (n), (m) RETURN n, m', done)
88+
verifyNotifications(
89+
session,
90+
'EXPLAIN MATCH (n:ThisLabelDoesNotExist) RETURN n',
91+
done
92+
)
8593
})
8694
})
8795

0 commit comments

Comments
 (0)