@@ -22,8 +22,8 @@ const Neo4jMock = Neo4jMockImport as unknown as typeof Neo4jMockType;
22
22
23
23
24
24
describe ( 'Neovis' , ( ) => {
25
- const container_id = 'randomId' ;
26
- const initial_cypher = 'test query' ;
25
+ const containerId = 'randomId' ;
26
+ const initialCypher = 'test query' ;
27
27
const label1 = 'label1' ;
28
28
const label2 = 'label2' ;
29
29
const relationshipType = 'TEST' ;
@@ -32,7 +32,7 @@ describe('Neovis', () => {
32
32
beforeEach ( ( ) => Neo4jMock . clearAllMocks ( ) ) ;
33
33
beforeEach ( ( ) => {
34
34
testUtils . clearIdCounter ( ) ;
35
- document . body . innerHTML = `<div id="${ container_id } "></div>` ;
35
+ document . body . innerHTML = `<div id="${ containerId } "></div>` ;
36
36
} ) ;
37
37
38
38
describe ( 'NeoVis config defaults behavior' , ( ) => {
@@ -123,12 +123,12 @@ describe('Neovis', () => {
123
123
124
124
describe ( 'Neovis default behavior' , ( ) => {
125
125
beforeEach ( ( ) => {
126
- neovis = new Neovis ( { initial_cypher , container_id } ) ;
126
+ neovis = new Neovis ( { initialCypher , containerId } ) ;
127
127
} ) ;
128
128
129
129
it ( 'should call run with query' , ( ) => {
130
130
neovis . render ( ) ;
131
- expect ( Neo4jMock . mockSessionRun ) . toHaveBeenCalledWith ( initial_cypher , { limit : 30 } ) ;
131
+ expect ( Neo4jMock . mockSessionRun ) . toHaveBeenCalledWith ( initialCypher , { limit : 30 } ) ;
132
132
} ) ;
133
133
134
134
it ( 'should call completed when complete' , ( ) => new Promise < void > ( done => {
@@ -215,8 +215,8 @@ describe('Neovis', () => {
215
215
describe ( 'neovis with sizeCypher' , ( ) => {
216
216
const sizeCypher = 'sizeCypher' ;
217
217
const neovisConfig = {
218
- initial_cypher ,
219
- container_id ,
218
+ initialCypher ,
219
+ containerId ,
220
220
labels : {
221
221
[ label1 ] : {
222
222
[ NEOVIS_ADVANCED_CONFIG ] : {
@@ -234,7 +234,7 @@ describe('Neovis', () => {
234
234
it ( 'should call sizeCypher and save return value to data set value' , async ( ) => {
235
235
const node = testUtils . makeNode ( [ label1 ] ) ;
236
236
testUtils . mockFullRunSubscribe ( {
237
- [ initial_cypher ] : {
237
+ [ initialCypher ] : {
238
238
default : [ testUtils . makeRecord ( [ node ] ) ]
239
239
} ,
240
240
[ sizeCypher ] : {
@@ -252,14 +252,14 @@ describe('Neovis', () => {
252
252
describe ( 'neovis with update cypher' , ( ) => {
253
253
const updateWithCypher = 'updateCypher' ;
254
254
beforeEach ( ( ) => {
255
- neovis = new Neovis ( { initial_cypher , container_id } ) ;
255
+ neovis = new Neovis ( { initialCypher , containerId } ) ;
256
256
} ) ;
257
257
258
258
it ( 'should call updateWithCypher and add the new node to visualization' , async ( ) => {
259
259
const node1 = testUtils . makeNode ( [ label1 ] ) ;
260
260
const node2 = testUtils . makeNode ( [ label1 ] ) ;
261
261
testUtils . mockFullRunSubscribe ( {
262
- [ initial_cypher ] : {
262
+ [ initialCypher ] : {
263
263
default : [ testUtils . makeRecord ( [ node1 ] ) ]
264
264
} ,
265
265
[ updateWithCypher ] : {
@@ -280,7 +280,7 @@ describe('Neovis', () => {
280
280
it ( 'call updateWithCypher with same init query should not create duplicate nodes' , async ( ) => {
281
281
const node1 = testUtils . makeNode ( [ label1 ] ) ;
282
282
testUtils . mockFullRunSubscribe ( {
283
- [ initial_cypher ] : {
283
+ [ initialCypher ] : {
284
284
default : [ testUtils . makeRecord ( [ node1 ] ) ]
285
285
}
286
286
} ) ;
@@ -289,7 +289,7 @@ describe('Neovis', () => {
289
289
await testUtils . neovisRenderDonePromise ( neovis ) ;
290
290
expect ( Neo4jMock . mockSessionRun ) . toHaveBeenCalledTimes ( 1 ) ;
291
291
expect ( neovis . nodes . length ) . toBe ( 1 ) ; // 1 node before update with cypher
292
- neovis . updateWithCypher ( initial_cypher ) ; // do the update
292
+ neovis . updateWithCypher ( initialCypher ) ; // do the update
293
293
await testUtils . neovisRenderDonePromise ( neovis ) ;
294
294
expect ( Neo4jMock . mockSessionRun ) . toHaveBeenCalledTimes ( 1 + 1 ) ; // once for initial cypher and once for the update
295
295
expect ( neovis . nodes . length ) . toBe ( 1 ) ; // 1 node after update with cypher
@@ -300,7 +300,7 @@ describe('Neovis', () => {
300
300
const fontSize = 28 ;
301
301
const fontColor = '#00FF00' ;
302
302
describe . each ( [ [ 'config' , {
303
- container_id ,
303
+ containerId ,
304
304
labels : {
305
305
[ label1 ] : {
306
306
[ NEOVIS_ADVANCED_CONFIG ] : {
@@ -314,9 +314,9 @@ describe('Neovis', () => {
314
314
}
315
315
}
316
316
} ,
317
- initial_cypher : initial_cypher
317
+ initialCypher
318
318
} as Partial < NeovisConfig > ] , [ 'non flat config' , {
319
- container_id ,
319
+ containerId ,
320
320
nonFlat : true ,
321
321
labels : {
322
322
[ label1 ] : {
@@ -329,7 +329,7 @@ describe('Neovis', () => {
329
329
}
330
330
}
331
331
} ,
332
- initial_cypher : initial_cypher
332
+ initialCypher
333
333
} as Partial < NonFlatNeovisConfig > ] ] ) ( 'neovis advance %s test' , ( configName : string , config ) => {
334
334
beforeEach ( ( ) => {
335
335
neovis = new Neovis ( config as NonFlatNeovisConfig | NeovisConfig ) ;
@@ -338,7 +338,7 @@ describe('Neovis', () => {
338
338
it ( 'image field in config should reflect in node data' , async ( ) => {
339
339
const node1 = testUtils . makeNode ( [ label1 ] ) ;
340
340
testUtils . mockFullRunSubscribe ( {
341
- [ initial_cypher ] : {
341
+ [ initialCypher ] : {
342
342
default : [ testUtils . makeRecord ( [ node1 ] ) ]
343
343
}
344
344
} ) ;
@@ -351,7 +351,7 @@ describe('Neovis', () => {
351
351
it ( 'image field for type not specified in config should not reflect in node data' , async ( ) => {
352
352
const node1 = testUtils . makeNode ( [ label2 ] ) ;
353
353
testUtils . mockFullRunSubscribe ( {
354
- [ initial_cypher ] : {
354
+ [ initialCypher ] : {
355
355
default : [ testUtils . makeRecord ( [ node1 ] ) ]
356
356
}
357
357
} ) ;
@@ -364,7 +364,7 @@ describe('Neovis', () => {
364
364
it ( 'font field in config should reflect in node data' , async ( ) => {
365
365
const node1 = testUtils . makeNode ( [ label1 ] ) ;
366
366
testUtils . mockFullRunSubscribe ( {
367
- [ initial_cypher ] : {
367
+ [ initialCypher ] : {
368
368
default : [ testUtils . makeRecord ( [ node1 ] ) ]
369
369
}
370
370
} ) ;
@@ -379,7 +379,7 @@ describe('Neovis', () => {
379
379
it ( 'font field for type not specified in config should not reflect in node data' , async ( ) => {
380
380
const node1 = testUtils . makeNode ( [ label2 ] ) ;
381
381
testUtils . mockFullRunSubscribe ( {
382
- [ initial_cypher ] : {
382
+ [ initialCypher ] : {
383
383
default : [ testUtils . makeRecord ( [ node1 ] ) ]
384
384
}
385
385
} ) ;
@@ -398,7 +398,7 @@ describe('Neovis', () => {
398
398
399
399
it ( 'should merge property name type to vis.js config properly' , async ( ) => {
400
400
const config : NeovisConfig = {
401
- container_id : container_id ,
401
+ containerId ,
402
402
labels : {
403
403
[ label1 ] : {
404
404
font : {
@@ -407,12 +407,12 @@ describe('Neovis', () => {
407
407
} ,
408
408
}
409
409
} ,
410
- initial_cypher : initial_cypher
410
+ initialCypher
411
411
} ;
412
412
neovis = new Neovis ( config ) ;
413
413
const node1 = testUtils . makeNode ( [ label1 ] , { [ intProperty ] : intPropertyValue } ) ;
414
414
testUtils . mockFullRunSubscribe ( {
415
- [ initial_cypher ] : {
415
+ [ initialCypher ] : {
416
416
default : [ testUtils . makeRecord ( [ node1 ] ) ]
417
417
}
418
418
} ) ;
@@ -426,7 +426,7 @@ describe('Neovis', () => {
426
426
427
427
it ( 'should merge static type to vis.js config properly' , async ( ) => {
428
428
const config : Partial < NeovisConfig > = {
429
- container_id ,
429
+ containerId ,
430
430
labels : {
431
431
[ label1 ] : {
432
432
[ NEOVIS_ADVANCED_CONFIG ] : {
@@ -436,12 +436,12 @@ describe('Neovis', () => {
436
436
}
437
437
}
438
438
} ,
439
- initial_cypher
439
+ initialCypher
440
440
} ;
441
441
neovis = new Neovis ( config as NeovisConfig ) ;
442
442
const node1 = testUtils . makeNode ( [ label1 ] , { [ intProperty ] : intPropertyValue } ) ;
443
443
testUtils . mockFullRunSubscribe ( {
444
- [ initial_cypher ] : {
444
+ [ initialCypher ] : {
445
445
default : [ testUtils . makeRecord ( [ node1 ] ) ]
446
446
}
447
447
} ) ;
@@ -453,7 +453,7 @@ describe('Neovis', () => {
453
453
454
454
it ( 'should merge function type to vis.js config properly' , async ( ) => {
455
455
const config : Partial < NeovisConfig > = {
456
- container_id : container_id ,
456
+ containerId ,
457
457
labels : {
458
458
[ label1 ] : {
459
459
[ NEOVIS_ADVANCED_CONFIG ] : {
@@ -463,12 +463,12 @@ describe('Neovis', () => {
463
463
}
464
464
}
465
465
} ,
466
- initial_cypher : initial_cypher
466
+ initialCypher
467
467
} ;
468
468
neovis = new Neovis ( config as NeovisConfig ) ;
469
469
const node1 = testUtils . makeNode ( [ label1 ] , { [ intProperty ] : intPropertyValue } ) ;
470
470
testUtils . mockFullRunSubscribe ( {
471
- [ initial_cypher ] : {
471
+ [ initialCypher ] : {
472
472
default : [ testUtils . makeRecord ( [ node1 ] ) ]
473
473
}
474
474
} ) ;
@@ -481,7 +481,7 @@ describe('Neovis', () => {
481
481
it ( 'should merge cypher type to vis.js config properly' , async ( ) => {
482
482
const sizeCypher = 'sizeCypher' ;
483
483
const config : Partial < NeovisConfig > = {
484
- container_id ,
484
+ containerId ,
485
485
labels : {
486
486
[ label1 ] : {
487
487
[ NEOVIS_ADVANCED_CONFIG ] : {
@@ -491,12 +491,12 @@ describe('Neovis', () => {
491
491
}
492
492
}
493
493
} ,
494
- initial_cypher : initial_cypher
494
+ initialCypher
495
495
} ;
496
496
neovis = new Neovis ( config as NeovisConfig ) ;
497
497
const node1 = testUtils . makeNode ( [ label1 ] , { [ intProperty ] : intPropertyValue } ) ;
498
498
testUtils . mockFullRunSubscribe ( {
499
- [ initial_cypher ] : {
499
+ [ initialCypher ] : {
500
500
default : [ testUtils . makeRecord ( [ node1 ] ) ]
501
501
} ,
502
502
[ sizeCypher ] : {
@@ -513,8 +513,8 @@ describe('Neovis', () => {
513
513
514
514
describe ( 'neovis config migration' , ( ) => {
515
515
const oldConfig : Partial < OldNeoVisConfig > = {
516
- initial_cypher,
517
- container_id,
516
+ initial_cypher : initialCypher ,
517
+ container_id : containerId ,
518
518
labels : {
519
519
a : {
520
520
caption : 'name'
0 commit comments