|
20 | 20 | import neo4j from '../src'
|
21 | 21 | import sharedNeo4j from './internal/shared-neo4j'
|
22 | 22 | import { toNumber, internal } from 'neo4j-driver-core'
|
23 |
| -import timesSeries from 'async/timesSeries' |
24 | 23 | import testUtils from './internal/test-utils'
|
25 | 24 |
|
26 | 25 | const {
|
@@ -55,11 +54,11 @@ describe('#integration temporal-types', () => {
|
55 | 54 |
|
56 | 55 | beforeAll(() => {
|
57 | 56 | driver = neo4j.driver(
|
58 |
| - `bolt://${sharedNeo4j.hostname}`, |
| 57 | + `${sharedNeo4j.scheme}://${sharedNeo4j.hostname}`, |
59 | 58 | sharedNeo4j.authToken
|
60 | 59 | )
|
61 | 60 | driverWithNativeNumbers = neo4j.driver(
|
62 |
| - `bolt://${sharedNeo4j.hostname}`, |
| 61 | + `${sharedNeo4j.scheme}://${sharedNeo4j.hostname}`, |
63 | 62 | sharedNeo4j.authToken,
|
64 | 63 | { disableLosslessIntegers: true }
|
65 | 64 | )
|
@@ -101,13 +100,13 @@ describe('#integration temporal-types', () => {
|
101 | 100 | )
|
102 | 101 | }, 90000)
|
103 | 102 |
|
104 |
| - it('should send and receive random Duration', async () => { |
| 103 | + describe('Duration', () => { |
105 | 104 | if (neo4jDoesNotSupportTemporalTypes()) {
|
106 | 105 | return
|
107 | 106 | }
|
108 | 107 |
|
109 |
| - await testSendAndReceiveRandomTemporalValues(() => randomDuration()) |
110 |
| - }, 90000) |
| 108 | + testSendAndReceiveRandomTemporalValues('Duration', () => randomDuration()) |
| 109 | + }) |
111 | 110 |
|
112 | 111 | it('should send and receive Duration when disableLosslessIntegers=true', async () => {
|
113 | 112 | if (neo4jDoesNotSupportTemporalTypes()) {
|
@@ -169,13 +168,13 @@ describe('#integration temporal-types', () => {
|
169 | 168 | )
|
170 | 169 | }, 90000)
|
171 | 170 |
|
172 |
| - it('should send and receive random LocalTime', async () => { |
| 171 | + describe('LocalTime', () => { |
173 | 172 | if (neo4jDoesNotSupportTemporalTypes()) {
|
174 | 173 | return
|
175 | 174 | }
|
176 | 175 |
|
177 |
| - await testSendAndReceiveRandomTemporalValues(() => randomLocalTime()) |
178 |
| - }, 90000) |
| 176 | + testSendAndReceiveRandomTemporalValues('LocalTime', () => randomLocalTime()) |
| 177 | + }) |
179 | 178 |
|
180 | 179 | it('should send and receive array of LocalTime', async () => {
|
181 | 180 | if (neo4jDoesNotSupportTemporalTypes()) {
|
@@ -226,13 +225,13 @@ describe('#integration temporal-types', () => {
|
226 | 225 | )
|
227 | 226 | }, 90000)
|
228 | 227 |
|
229 |
| - it('should send and receive random Time', async () => { |
| 228 | + describe('Time', async () => { |
230 | 229 | if (neo4jDoesNotSupportTemporalTypes()) {
|
231 | 230 | return
|
232 | 231 | }
|
233 | 232 |
|
234 |
| - await testSendAndReceiveRandomTemporalValues(() => randomTime()) |
235 |
| - }, 90000) |
| 233 | + testSendAndReceiveRandomTemporalValues('Time', () => randomTime()) |
| 234 | + }) |
236 | 235 |
|
237 | 236 | it('should send and receive array of Time', async () => {
|
238 | 237 | if (neo4jDoesNotSupportTemporalTypes()) {
|
@@ -281,13 +280,13 @@ describe('#integration temporal-types', () => {
|
281 | 280 | await testSendReceiveTemporalValue(new neo4j.types.Date(1923, 8, 14))
|
282 | 281 | }, 90000)
|
283 | 282 |
|
284 |
| - it('should send and receive random Date', async () => { |
| 283 | + describe('Date', () => { |
285 | 284 | if (neo4jDoesNotSupportTemporalTypes()) {
|
286 | 285 | return
|
287 | 286 | }
|
288 | 287 |
|
289 |
| - await testSendAndReceiveRandomTemporalValues(() => randomDate()) |
290 |
| - }, 90000) |
| 288 | + testSendAndReceiveRandomTemporalValues('Date', () => randomDate()) |
| 289 | + }) |
291 | 290 |
|
292 | 291 | it('should send and receive array of Date', async () => {
|
293 | 292 | if (neo4jDoesNotSupportTemporalTypes()) {
|
@@ -346,13 +345,13 @@ describe('#integration temporal-types', () => {
|
346 | 345 | )
|
347 | 346 | }, 90000)
|
348 | 347 |
|
349 |
| - it('should send and receive random LocalDateTime', async () => { |
| 348 | + describe('LocalDateTime', async () => { |
350 | 349 | if (neo4jDoesNotSupportTemporalTypes()) {
|
351 | 350 | return
|
352 | 351 | }
|
353 | 352 |
|
354 |
| - await testSendAndReceiveRandomTemporalValues(() => randomLocalDateTime()) |
355 |
| - }, 90000) |
| 353 | + testSendAndReceiveRandomTemporalValues('LocalDateTime', () => randomLocalDateTime()) |
| 354 | + }) |
356 | 355 |
|
357 | 356 | it('should send and receive array of random LocalDateTime', async () => {
|
358 | 357 | if (neo4jDoesNotSupportTemporalTypes()) {
|
@@ -442,15 +441,15 @@ describe('#integration temporal-types', () => {
|
442 | 441 | )
|
443 | 442 | }, 90000)
|
444 | 443 |
|
445 |
| - it('should send and receive random DateTime with zone offset', async () => { |
| 444 | + describe('DateTime with zone offset', () => { |
446 | 445 | if (neo4jDoesNotSupportTemporalTypes()) {
|
447 | 446 | return
|
448 | 447 | }
|
449 | 448 |
|
450 |
| - await testSendAndReceiveRandomTemporalValues(() => |
| 449 | + testSendAndReceiveRandomTemporalValues('DateTime with zone offset', () => |
451 | 450 | randomDateTimeWithZoneOffset()
|
452 | 451 | )
|
453 |
| - }, 90000) |
| 452 | + }) |
454 | 453 |
|
455 | 454 | it('should send and receive array of DateTime with zone offset', async () => {
|
456 | 455 | if (neo4jDoesNotSupportTemporalTypes()) {
|
@@ -540,15 +539,15 @@ describe('#integration temporal-types', () => {
|
540 | 539 | )
|
541 | 540 | }, 90000)
|
542 | 541 |
|
543 |
| - it('should send and receive random DateTime with zone id', async () => { |
| 542 | + describe('DateTime with zone id', async () => { |
544 | 543 | if (neo4jDoesNotSupportTemporalTypes()) {
|
545 | 544 | return
|
546 | 545 | }
|
547 | 546 |
|
548 |
| - await testSendAndReceiveRandomTemporalValues(() => |
| 547 | + testSendAndReceiveRandomTemporalValues('DateTime with zone id', () => |
549 | 548 | randomDateTimeWithZoneId()
|
550 | 549 | )
|
551 |
| - }, 90000) |
| 550 | + }) |
552 | 551 |
|
553 | 552 | it('should send and receive array of DateTime with zone id', async () => {
|
554 | 553 | if (neo4jDoesNotSupportTemporalTypes()) {
|
@@ -1403,22 +1402,12 @@ describe('#integration temporal-types', () => {
|
1403 | 1402 | )
|
1404 | 1403 | })
|
1405 | 1404 |
|
1406 |
| - function testSendAndReceiveRandomTemporalValues (valueGenerator) { |
1407 |
| - const asyncFunction = (index, callback) => { |
1408 |
| - testSendReceiveTemporalValue(valueGenerator()) |
1409 |
| - .then(() => callback()) |
1410 |
| - .catch(error => callback(error)) |
1411 |
| - } |
1412 |
| - |
1413 |
| - return new Promise((resolve, reject) => { |
1414 |
| - timesSeries(RANDOM_VALUES_TO_TEST, asyncFunction, (error, result) => { |
1415 |
| - if (error) { |
1416 |
| - reject(error) |
1417 |
| - } else { |
1418 |
| - resolve(result) |
1419 |
| - } |
| 1405 | + function testSendAndReceiveRandomTemporalValues (temporalType, valueGenerator) { |
| 1406 | + for (let i = 0; i < RANDOM_VALUES_TO_TEST; i++) { |
| 1407 | + it(`should send and receive random ${temporalType} [index=${i}]`, async () => { |
| 1408 | + await testSendReceiveTemporalValue(valueGenerator()) |
1420 | 1409 | })
|
1421 |
| - }) |
| 1410 | + } |
1422 | 1411 | }
|
1423 | 1412 |
|
1424 | 1413 | async function testSendAndReceiveArrayOfRandomTemporalValues (valueGenerator) {
|
@@ -1463,10 +1452,10 @@ describe('#integration temporal-types', () => {
|
1463 | 1452 | }
|
1464 | 1453 |
|
1465 | 1454 | async function testSendReceiveTemporalValue (value) {
|
1466 |
| - const result = await session.run( |
| 1455 | + const result = await session.executeWrite(tx => tx.run( |
1467 | 1456 | 'CREATE (n:Node {value: $value}) RETURN n.value',
|
1468 | 1457 | { value: value }
|
1469 |
| - ) |
| 1458 | + )) |
1470 | 1459 |
|
1471 | 1460 | const records = result.records
|
1472 | 1461 | expect(records.length).toEqual(1)
|
|
0 commit comments