@@ -21,7 +21,6 @@ import neo4j from '../src'
2121import sharedNeo4j from './internal/shared-neo4j'
2222import { toNumber , internal } from 'neo4j-driver-core'
2323import timesSeries from 'async/timesSeries'
24- import _ from 'lodash'
2524import testUtils from './internal/test-utils'
2625
2726const {
@@ -1423,11 +1422,11 @@ describe('#integration temporal-types', () => {
14231422 }
14241423
14251424 async function testSendAndReceiveArrayOfRandomTemporalValues ( valueGenerator ) {
1426- const arrayLength = _ . random (
1425+ const arrayLength = random (
14271426 MIN_TEMPORAL_ARRAY_LENGTH ,
14281427 MAX_TEMPORAL_ARRAY_LENGTH
14291428 )
1430- const values = _ . range ( arrayLength ) . map ( ( ) => valueGenerator ( ) )
1429+ const values = range ( arrayLength ) . map ( ( ) => valueGenerator ( ) )
14311430
14321431 await testSendReceiveTemporalValue ( values )
14331432 }
@@ -1486,12 +1485,12 @@ describe('#integration temporal-types', () => {
14861485 }
14871486
14881487 function randomDuration ( ) {
1489- const sign = _ . sample ( [ - 1 , 1 ] ) // duration can be negative
1488+ const sign = sample ( [ - 1 , 1 ] ) // duration can be negative
14901489 return duration (
1491- sign * _ . random ( 0 , MAX_DURATION_COMPONENT ) ,
1492- sign * _ . random ( 0 , MAX_DURATION_COMPONENT ) ,
1493- sign * _ . random ( 0 , MAX_DURATION_COMPONENT ) ,
1494- _ . random ( 0 , MAX_NANO_OF_SECOND )
1490+ sign * random ( 0 , MAX_DURATION_COMPONENT ) ,
1491+ sign * random ( 0 , MAX_DURATION_COMPONENT ) ,
1492+ sign * random ( 0 , MAX_DURATION_COMPONENT ) ,
1493+ random ( 0 , MAX_NANO_OF_SECOND )
14951494 )
14961495 }
14971496
@@ -1600,7 +1599,24 @@ describe('#integration temporal-types', () => {
16001599 }
16011600
16021601 function randomZoneId ( ) {
1603- return _ . sample ( ZONE_IDS )
1602+ return sample ( ZONE_IDS )
1603+ }
1604+
1605+ function random ( lower , upper ) {
1606+ const interval = upper - lower
1607+ return lower + Math . floor ( Math . random ( ) * interval )
1608+ }
1609+
1610+ function range ( size ) {
1611+ const arr = [ ]
1612+ for ( let i ; i < size ; i ++ ) {
1613+ arr . push ( i )
1614+ }
1615+ return arr
1616+ }
1617+
1618+ function sample ( arr ) {
1619+ return arr [ Math . floor ( Math . random ( ) * arr . length ) ]
16041620 }
16051621
16061622 function duration ( months , days , seconds , nanoseconds ) {
@@ -1698,7 +1714,7 @@ describe('#integration temporal-types', () => {
16981714 }
16991715
17001716 function randomInt ( lower , upper ) {
1701- return neo4j . int ( _ . random ( lower , upper ) )
1717+ return neo4j . int ( random ( lower , upper ) )
17021718 }
17031719
17041720 function testStandardDateToLocalTimeConversion ( date , nanosecond ) {
0 commit comments