@ellipticltd/aml-utils 0.15.1 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nyc_output/cd455ec6-4d73-4c5e-871e-7f0609bd11b8.json +1 -0
- package/.nyc_output/d6cd0f05-9810-4f97-8faa-8753f10b9d2d.json +1 -0
- package/.nyc_output/processinfo/3974a52e-3acc-45e4-a312-2dae8e2da051.json +1 -0
- package/.nyc_output/processinfo/3bbc21ec-7576-45f9-bc87-b6a79588c265.json +1 -0
- package/.nyc_output/processinfo/cd455ec6-4d73-4c5e-871e-7f0609bd11b8.json +1 -0
- package/.nyc_output/processinfo/d6cd0f05-9810-4f97-8faa-8753f10b9d2d.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/coverage/errors/errors.js.html +1 -1
- package/coverage/errors/errors.spec.js.html +15 -15
- package/coverage/errors/index.html +12 -12
- package/coverage/file-parser/__tests/file-parser.spec.js.html +96 -96
- package/coverage/file-parser/__tests/index.html +32 -32
- package/coverage/file-parser/__tests/parse-row.spec.js.html +36 -36
- package/coverage/file-parser/__tests/sanitize-rows.spec.js.html +49 -49
- package/coverage/formatting/formatting.js.html +21 -21
- package/coverage/formatting/formatting.spec.js.html +30 -30
- package/coverage/formatting/index.html +28 -28
- package/coverage/index.html +54 -54
- package/coverage/middleware/index.html +1 -1
- package/coverage/middleware/middleware.js.html +1 -1
- package/coverage/orm-helpers/index.html +26 -26
- package/coverage/orm-helpers/ormHelpers.js.html +24 -24
- package/coverage/orm-helpers/ormHelpers.spec.js.html +9 -9
- package/coverage/types/index.html +1 -1
- package/coverage/types/types.js.html +1 -1
- package/coverage/validations/index.html +30 -30
- package/coverage/validations/validations.js.html +545 -236
- package/coverage/validations/validations.spec.js.html +525 -159
- package/dist/validations/validations.js +1 -1
- package/dist/validations/validations.spec.js +14 -0
- package/lib/validations/validations.js +1 -1
- package/lib/validations/validations.spec.js +19 -0
- package/package.json +1 -1
- package/.idea/aml-utils.iml +0 -12
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.nyc_output/62fbf615-4746-451c-aa0c-c12cb22b7a9d.json +0 -1
- package/.nyc_output/fd0c5a49-1dee-497a-bd75-dcf009fcab1e.json +0 -1
- package/.nyc_output/processinfo/1aa97f38-9e09-4229-9e02-5f7fa02f213b.json +0 -1
- package/.nyc_output/processinfo/62fbf615-4746-451c-aa0c-c12cb22b7a9d.json +0 -1
- package/.nyc_output/processinfo/b5dcfb1d-3f6e-47a0-89e4-e93e7bcc51d7.json +0 -1
- package/.nyc_output/processinfo/fd0c5a49-1dee-497a-bd75-dcf009fcab1e.json +0 -1
- /package/.nyc_output/{1aa97f38-9e09-4229-9e02-5f7fa02f213b.json → 3974a52e-3acc-45e4-a312-2dae8e2da051.json} +0 -0
- /package/.nyc_output/{b5dcfb1d-3f6e-47a0-89e4-e93e7bcc51d7.json → 3bbc21ec-7576-45f9-bc87-b6a79588c265.json} +0 -0
|
@@ -20,31 +20,31 @@
|
|
|
20
20
|
</h1>
|
|
21
21
|
<div class='clearfix'>
|
|
22
22
|
<div class='fl pad1y space-right2'>
|
|
23
|
-
<span class="strong">
|
|
23
|
+
<span class="strong">99.23% </span>
|
|
24
24
|
<span class="quiet">Statements</span>
|
|
25
|
-
<span class='fraction'>
|
|
25
|
+
<span class='fraction'>385/388</span>
|
|
26
26
|
</div>
|
|
27
27
|
<div class='fl pad1y space-right2'>
|
|
28
|
-
<span class="strong">
|
|
28
|
+
<span class="strong">83.33% </span>
|
|
29
29
|
<span class="quiet">Branches</span>
|
|
30
|
-
<span class='fraction'>
|
|
30
|
+
<span class='fraction'>20/24</span>
|
|
31
31
|
</div>
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">98.69% </span>
|
|
34
34
|
<span class="quiet">Functions</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>226/229</span>
|
|
36
36
|
</div>
|
|
37
37
|
<div class='fl pad1y space-right2'>
|
|
38
|
-
<span class="strong">
|
|
38
|
+
<span class="strong">100% </span>
|
|
39
39
|
<span class="quiet">Lines</span>
|
|
40
|
-
<span class='fraction'>
|
|
40
|
+
<span class='fraction'>255/255</span>
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
43
43
|
<p class="quiet">
|
|
44
44
|
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
45
45
|
</p>
|
|
46
46
|
</div>
|
|
47
|
-
<div class='status-line
|
|
47
|
+
<div class='status-line high'></div>
|
|
48
48
|
<pre><table class="coverage">
|
|
49
49
|
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
50
50
|
<a name='L2'></a><a href='#L2'>2</a>
|
|
@@ -413,7 +413,129 @@
|
|
|
413
413
|
<a name='L365'></a><a href='#L365'>365</a>
|
|
414
414
|
<a name='L366'></a><a href='#L366'>366</a>
|
|
415
415
|
<a name='L367'></a><a href='#L367'>367</a>
|
|
416
|
-
<a name='L368'></a><a href='#L368'>368</a
|
|
416
|
+
<a name='L368'></a><a href='#L368'>368</a>
|
|
417
|
+
<a name='L369'></a><a href='#L369'>369</a>
|
|
418
|
+
<a name='L370'></a><a href='#L370'>370</a>
|
|
419
|
+
<a name='L371'></a><a href='#L371'>371</a>
|
|
420
|
+
<a name='L372'></a><a href='#L372'>372</a>
|
|
421
|
+
<a name='L373'></a><a href='#L373'>373</a>
|
|
422
|
+
<a name='L374'></a><a href='#L374'>374</a>
|
|
423
|
+
<a name='L375'></a><a href='#L375'>375</a>
|
|
424
|
+
<a name='L376'></a><a href='#L376'>376</a>
|
|
425
|
+
<a name='L377'></a><a href='#L377'>377</a>
|
|
426
|
+
<a name='L378'></a><a href='#L378'>378</a>
|
|
427
|
+
<a name='L379'></a><a href='#L379'>379</a>
|
|
428
|
+
<a name='L380'></a><a href='#L380'>380</a>
|
|
429
|
+
<a name='L381'></a><a href='#L381'>381</a>
|
|
430
|
+
<a name='L382'></a><a href='#L382'>382</a>
|
|
431
|
+
<a name='L383'></a><a href='#L383'>383</a>
|
|
432
|
+
<a name='L384'></a><a href='#L384'>384</a>
|
|
433
|
+
<a name='L385'></a><a href='#L385'>385</a>
|
|
434
|
+
<a name='L386'></a><a href='#L386'>386</a>
|
|
435
|
+
<a name='L387'></a><a href='#L387'>387</a>
|
|
436
|
+
<a name='L388'></a><a href='#L388'>388</a>
|
|
437
|
+
<a name='L389'></a><a href='#L389'>389</a>
|
|
438
|
+
<a name='L390'></a><a href='#L390'>390</a>
|
|
439
|
+
<a name='L391'></a><a href='#L391'>391</a>
|
|
440
|
+
<a name='L392'></a><a href='#L392'>392</a>
|
|
441
|
+
<a name='L393'></a><a href='#L393'>393</a>
|
|
442
|
+
<a name='L394'></a><a href='#L394'>394</a>
|
|
443
|
+
<a name='L395'></a><a href='#L395'>395</a>
|
|
444
|
+
<a name='L396'></a><a href='#L396'>396</a>
|
|
445
|
+
<a name='L397'></a><a href='#L397'>397</a>
|
|
446
|
+
<a name='L398'></a><a href='#L398'>398</a>
|
|
447
|
+
<a name='L399'></a><a href='#L399'>399</a>
|
|
448
|
+
<a name='L400'></a><a href='#L400'>400</a>
|
|
449
|
+
<a name='L401'></a><a href='#L401'>401</a>
|
|
450
|
+
<a name='L402'></a><a href='#L402'>402</a>
|
|
451
|
+
<a name='L403'></a><a href='#L403'>403</a>
|
|
452
|
+
<a name='L404'></a><a href='#L404'>404</a>
|
|
453
|
+
<a name='L405'></a><a href='#L405'>405</a>
|
|
454
|
+
<a name='L406'></a><a href='#L406'>406</a>
|
|
455
|
+
<a name='L407'></a><a href='#L407'>407</a>
|
|
456
|
+
<a name='L408'></a><a href='#L408'>408</a>
|
|
457
|
+
<a name='L409'></a><a href='#L409'>409</a>
|
|
458
|
+
<a name='L410'></a><a href='#L410'>410</a>
|
|
459
|
+
<a name='L411'></a><a href='#L411'>411</a>
|
|
460
|
+
<a name='L412'></a><a href='#L412'>412</a>
|
|
461
|
+
<a name='L413'></a><a href='#L413'>413</a>
|
|
462
|
+
<a name='L414'></a><a href='#L414'>414</a>
|
|
463
|
+
<a name='L415'></a><a href='#L415'>415</a>
|
|
464
|
+
<a name='L416'></a><a href='#L416'>416</a>
|
|
465
|
+
<a name='L417'></a><a href='#L417'>417</a>
|
|
466
|
+
<a name='L418'></a><a href='#L418'>418</a>
|
|
467
|
+
<a name='L419'></a><a href='#L419'>419</a>
|
|
468
|
+
<a name='L420'></a><a href='#L420'>420</a>
|
|
469
|
+
<a name='L421'></a><a href='#L421'>421</a>
|
|
470
|
+
<a name='L422'></a><a href='#L422'>422</a>
|
|
471
|
+
<a name='L423'></a><a href='#L423'>423</a>
|
|
472
|
+
<a name='L424'></a><a href='#L424'>424</a>
|
|
473
|
+
<a name='L425'></a><a href='#L425'>425</a>
|
|
474
|
+
<a name='L426'></a><a href='#L426'>426</a>
|
|
475
|
+
<a name='L427'></a><a href='#L427'>427</a>
|
|
476
|
+
<a name='L428'></a><a href='#L428'>428</a>
|
|
477
|
+
<a name='L429'></a><a href='#L429'>429</a>
|
|
478
|
+
<a name='L430'></a><a href='#L430'>430</a>
|
|
479
|
+
<a name='L431'></a><a href='#L431'>431</a>
|
|
480
|
+
<a name='L432'></a><a href='#L432'>432</a>
|
|
481
|
+
<a name='L433'></a><a href='#L433'>433</a>
|
|
482
|
+
<a name='L434'></a><a href='#L434'>434</a>
|
|
483
|
+
<a name='L435'></a><a href='#L435'>435</a>
|
|
484
|
+
<a name='L436'></a><a href='#L436'>436</a>
|
|
485
|
+
<a name='L437'></a><a href='#L437'>437</a>
|
|
486
|
+
<a name='L438'></a><a href='#L438'>438</a>
|
|
487
|
+
<a name='L439'></a><a href='#L439'>439</a>
|
|
488
|
+
<a name='L440'></a><a href='#L440'>440</a>
|
|
489
|
+
<a name='L441'></a><a href='#L441'>441</a>
|
|
490
|
+
<a name='L442'></a><a href='#L442'>442</a>
|
|
491
|
+
<a name='L443'></a><a href='#L443'>443</a>
|
|
492
|
+
<a name='L444'></a><a href='#L444'>444</a>
|
|
493
|
+
<a name='L445'></a><a href='#L445'>445</a>
|
|
494
|
+
<a name='L446'></a><a href='#L446'>446</a>
|
|
495
|
+
<a name='L447'></a><a href='#L447'>447</a>
|
|
496
|
+
<a name='L448'></a><a href='#L448'>448</a>
|
|
497
|
+
<a name='L449'></a><a href='#L449'>449</a>
|
|
498
|
+
<a name='L450'></a><a href='#L450'>450</a>
|
|
499
|
+
<a name='L451'></a><a href='#L451'>451</a>
|
|
500
|
+
<a name='L452'></a><a href='#L452'>452</a>
|
|
501
|
+
<a name='L453'></a><a href='#L453'>453</a>
|
|
502
|
+
<a name='L454'></a><a href='#L454'>454</a>
|
|
503
|
+
<a name='L455'></a><a href='#L455'>455</a>
|
|
504
|
+
<a name='L456'></a><a href='#L456'>456</a>
|
|
505
|
+
<a name='L457'></a><a href='#L457'>457</a>
|
|
506
|
+
<a name='L458'></a><a href='#L458'>458</a>
|
|
507
|
+
<a name='L459'></a><a href='#L459'>459</a>
|
|
508
|
+
<a name='L460'></a><a href='#L460'>460</a>
|
|
509
|
+
<a name='L461'></a><a href='#L461'>461</a>
|
|
510
|
+
<a name='L462'></a><a href='#L462'>462</a>
|
|
511
|
+
<a name='L463'></a><a href='#L463'>463</a>
|
|
512
|
+
<a name='L464'></a><a href='#L464'>464</a>
|
|
513
|
+
<a name='L465'></a><a href='#L465'>465</a>
|
|
514
|
+
<a name='L466'></a><a href='#L466'>466</a>
|
|
515
|
+
<a name='L467'></a><a href='#L467'>467</a>
|
|
516
|
+
<a name='L468'></a><a href='#L468'>468</a>
|
|
517
|
+
<a name='L469'></a><a href='#L469'>469</a>
|
|
518
|
+
<a name='L470'></a><a href='#L470'>470</a>
|
|
519
|
+
<a name='L471'></a><a href='#L471'>471</a>
|
|
520
|
+
<a name='L472'></a><a href='#L472'>472</a>
|
|
521
|
+
<a name='L473'></a><a href='#L473'>473</a>
|
|
522
|
+
<a name='L474'></a><a href='#L474'>474</a>
|
|
523
|
+
<a name='L475'></a><a href='#L475'>475</a>
|
|
524
|
+
<a name='L476'></a><a href='#L476'>476</a>
|
|
525
|
+
<a name='L477'></a><a href='#L477'>477</a>
|
|
526
|
+
<a name='L478'></a><a href='#L478'>478</a>
|
|
527
|
+
<a name='L479'></a><a href='#L479'>479</a>
|
|
528
|
+
<a name='L480'></a><a href='#L480'>480</a>
|
|
529
|
+
<a name='L481'></a><a href='#L481'>481</a>
|
|
530
|
+
<a name='L482'></a><a href='#L482'>482</a>
|
|
531
|
+
<a name='L483'></a><a href='#L483'>483</a>
|
|
532
|
+
<a name='L484'></a><a href='#L484'>484</a>
|
|
533
|
+
<a name='L485'></a><a href='#L485'>485</a>
|
|
534
|
+
<a name='L486'></a><a href='#L486'>486</a>
|
|
535
|
+
<a name='L487'></a><a href='#L487'>487</a>
|
|
536
|
+
<a name='L488'></a><a href='#L488'>488</a>
|
|
537
|
+
<a name='L489'></a><a href='#L489'>489</a>
|
|
538
|
+
<a name='L490'></a><a href='#L490'>490</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
|
417
539
|
<span class="cline-any cline-neutral"> </span>
|
|
418
540
|
<span class="cline-any cline-yes">1x</span>
|
|
419
541
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -451,12 +573,12 @@
|
|
|
451
573
|
<span class="cline-any cline-neutral"> </span>
|
|
452
574
|
<span class="cline-any cline-neutral"> </span>
|
|
453
575
|
<span class="cline-any cline-yes">1x</span>
|
|
454
|
-
<span class="cline-any cline-
|
|
576
|
+
<span class="cline-any cline-yes">1x</span>
|
|
455
577
|
<span class="cline-any cline-neutral"> </span>
|
|
456
578
|
<span class="cline-any cline-neutral"> </span>
|
|
457
579
|
<span class="cline-any cline-yes">1x</span>
|
|
458
|
-
<span class="cline-any cline-
|
|
459
|
-
<span class="cline-any cline-
|
|
580
|
+
<span class="cline-any cline-yes">1x</span>
|
|
581
|
+
<span class="cline-any cline-yes">1x</span>
|
|
460
582
|
<span class="cline-any cline-neutral"> </span>
|
|
461
583
|
<span class="cline-any cline-neutral"> </span>
|
|
462
584
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -465,8 +587,8 @@
|
|
|
465
587
|
<span class="cline-any cline-neutral"> </span>
|
|
466
588
|
<span class="cline-any cline-neutral"> </span>
|
|
467
589
|
<span class="cline-any cline-yes">1x</span>
|
|
468
|
-
<span class="cline-any cline-
|
|
469
|
-
<span class="cline-any cline-
|
|
590
|
+
<span class="cline-any cline-yes">1x</span>
|
|
591
|
+
<span class="cline-any cline-yes">1x</span>
|
|
470
592
|
<span class="cline-any cline-neutral"> </span>
|
|
471
593
|
<span class="cline-any cline-neutral"> </span>
|
|
472
594
|
<span class="cline-any cline-yes">1x</span>
|
|
@@ -488,26 +610,26 @@
|
|
|
488
610
|
<span class="cline-any cline-yes">1x</span>
|
|
489
611
|
<span class="cline-any cline-neutral"> </span>
|
|
490
612
|
<span class="cline-any cline-yes">1x</span>
|
|
491
|
-
<span class="cline-any cline-
|
|
613
|
+
<span class="cline-any cline-yes">1x</span>
|
|
492
614
|
<span class="cline-any cline-neutral"> </span>
|
|
493
615
|
<span class="cline-any cline-neutral"> </span>
|
|
494
616
|
<span class="cline-any cline-neutral"> </span>
|
|
495
617
|
<span class="cline-any cline-yes">1x</span>
|
|
496
618
|
<span class="cline-any cline-yes">1x</span>
|
|
497
|
-
<span class="cline-any cline-
|
|
619
|
+
<span class="cline-any cline-yes">1x</span>
|
|
498
620
|
<span class="cline-any cline-neutral"> </span>
|
|
499
621
|
<span class="cline-any cline-yes">1x</span>
|
|
500
|
-
<span class="cline-any cline-
|
|
622
|
+
<span class="cline-any cline-yes">1x</span>
|
|
501
623
|
<span class="cline-any cline-neutral"> </span>
|
|
502
624
|
<span class="cline-any cline-neutral"> </span>
|
|
503
625
|
<span class="cline-any cline-neutral"> </span>
|
|
504
626
|
<span class="cline-any cline-yes">1x</span>
|
|
505
627
|
<span class="cline-any cline-yes">1x</span>
|
|
506
|
-
<span class="cline-any cline-
|
|
628
|
+
<span class="cline-any cline-yes">1x</span>
|
|
507
629
|
<span class="cline-any cline-neutral"> </span>
|
|
508
630
|
<span class="cline-any cline-neutral"> </span>
|
|
509
631
|
<span class="cline-any cline-yes">1x</span>
|
|
510
|
-
<span class="cline-any cline-
|
|
632
|
+
<span class="cline-any cline-yes">1x</span>
|
|
511
633
|
<span class="cline-any cline-neutral"> </span>
|
|
512
634
|
<span class="cline-any cline-neutral"> </span>
|
|
513
635
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -515,11 +637,11 @@
|
|
|
515
637
|
<span class="cline-any cline-yes">1x</span>
|
|
516
638
|
<span class="cline-any cline-neutral"> </span>
|
|
517
639
|
<span class="cline-any cline-yes">1x</span>
|
|
518
|
-
<span class="cline-any cline-
|
|
640
|
+
<span class="cline-any cline-yes">1x</span>
|
|
519
641
|
<span class="cline-any cline-neutral"> </span>
|
|
520
642
|
<span class="cline-any cline-neutral"> </span>
|
|
521
643
|
<span class="cline-any cline-yes">1x</span>
|
|
522
|
-
<span class="cline-any cline-
|
|
644
|
+
<span class="cline-any cline-yes">1x</span>
|
|
523
645
|
<span class="cline-any cline-neutral"> </span>
|
|
524
646
|
<span class="cline-any cline-neutral"> </span>
|
|
525
647
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -527,37 +649,37 @@
|
|
|
527
649
|
<span class="cline-any cline-yes">1x</span>
|
|
528
650
|
<span class="cline-any cline-neutral"> </span>
|
|
529
651
|
<span class="cline-any cline-yes">1x</span>
|
|
530
|
-
<span class="cline-any cline-
|
|
652
|
+
<span class="cline-any cline-yes">1x</span>
|
|
531
653
|
<span class="cline-any cline-neutral"> </span>
|
|
532
654
|
<span class="cline-any cline-neutral"> </span>
|
|
533
655
|
<span class="cline-any cline-yes">1x</span>
|
|
534
|
-
<span class="cline-any cline-
|
|
656
|
+
<span class="cline-any cline-yes">1x</span>
|
|
535
657
|
<span class="cline-any cline-neutral"> </span>
|
|
536
658
|
<span class="cline-any cline-neutral"> </span>
|
|
537
659
|
<span class="cline-any cline-neutral"> </span>
|
|
538
660
|
<span class="cline-any cline-yes">1x</span>
|
|
539
661
|
<span class="cline-any cline-yes">1x</span>
|
|
540
|
-
<span class="cline-any cline-
|
|
541
|
-
<span class="cline-any cline-
|
|
662
|
+
<span class="cline-any cline-yes">1x</span>
|
|
663
|
+
<span class="cline-any cline-yes">1x</span>
|
|
542
664
|
<span class="cline-any cline-neutral"> </span>
|
|
543
665
|
<span class="cline-any cline-neutral"> </span>
|
|
544
666
|
<span class="cline-any cline-yes">1x</span>
|
|
545
|
-
<span class="cline-any cline-
|
|
546
|
-
<span class="cline-any cline-
|
|
547
|
-
<span class="cline-any cline-
|
|
667
|
+
<span class="cline-any cline-yes">1x</span>
|
|
668
|
+
<span class="cline-any cline-yes">1x</span>
|
|
669
|
+
<span class="cline-any cline-yes">1x</span>
|
|
548
670
|
<span class="cline-any cline-neutral"> </span>
|
|
549
671
|
<span class="cline-any cline-neutral"> </span>
|
|
550
672
|
<span class="cline-any cline-neutral"> </span>
|
|
551
673
|
<span class="cline-any cline-yes">1x</span>
|
|
552
674
|
<span class="cline-any cline-yes">1x</span>
|
|
553
|
-
<span class="cline-any cline-
|
|
554
|
-
<span class="cline-any cline-
|
|
675
|
+
<span class="cline-any cline-yes">1x</span>
|
|
676
|
+
<span class="cline-any cline-yes">1x</span>
|
|
555
677
|
<span class="cline-any cline-neutral"> </span>
|
|
556
678
|
<span class="cline-any cline-neutral"> </span>
|
|
557
679
|
<span class="cline-any cline-yes">1x</span>
|
|
558
|
-
<span class="cline-any cline-
|
|
559
|
-
<span class="cline-any cline-
|
|
560
|
-
<span class="cline-any cline-
|
|
680
|
+
<span class="cline-any cline-yes">1x</span>
|
|
681
|
+
<span class="cline-any cline-yes">1x</span>
|
|
682
|
+
<span class="cline-any cline-yes">1x</span>
|
|
561
683
|
<span class="cline-any cline-neutral"> </span>
|
|
562
684
|
<span class="cline-any cline-neutral"> </span>
|
|
563
685
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -690,6 +812,24 @@
|
|
|
690
812
|
<span class="cline-any cline-neutral"> </span>
|
|
691
813
|
<span class="cline-any cline-yes">1x</span>
|
|
692
814
|
<span class="cline-any cline-neutral"> </span>
|
|
815
|
+
<span class="cline-any cline-yes">1x</span>
|
|
816
|
+
<span class="cline-any cline-neutral"> </span>
|
|
817
|
+
<span class="cline-any cline-neutral"> </span>
|
|
818
|
+
<span class="cline-any cline-yes">1x</span>
|
|
819
|
+
<span class="cline-any cline-yes">1x</span>
|
|
820
|
+
<span class="cline-any cline-neutral"> </span>
|
|
821
|
+
<span class="cline-any cline-yes">1x</span>
|
|
822
|
+
<span class="cline-any cline-neutral"> </span>
|
|
823
|
+
<span class="cline-any cline-yes">1x</span>
|
|
824
|
+
<span class="cline-any cline-neutral"> </span>
|
|
825
|
+
<span class="cline-any cline-neutral"> </span>
|
|
826
|
+
<span class="cline-any cline-neutral"> </span>
|
|
827
|
+
<span class="cline-any cline-yes">1x</span>
|
|
828
|
+
<span class="cline-any cline-yes">1x</span>
|
|
829
|
+
<span class="cline-any cline-yes">1x</span>
|
|
830
|
+
<span class="cline-any cline-neutral"> </span>
|
|
831
|
+
<span class="cline-any cline-yes">1x</span>
|
|
832
|
+
<span class="cline-any cline-neutral"> </span>
|
|
693
833
|
<span class="cline-any cline-neutral"> </span>
|
|
694
834
|
<span class="cline-any cline-yes">1x</span>
|
|
695
835
|
<span class="cline-any cline-yes">1x</span>
|
|
@@ -780,6 +920,110 @@
|
|
|
780
920
|
<span class="cline-any cline-neutral"> </span>
|
|
781
921
|
<span class="cline-any cline-neutral"> </span>
|
|
782
922
|
<span class="cline-any cline-neutral"> </span>
|
|
923
|
+
<span class="cline-any cline-yes">1x</span>
|
|
924
|
+
<span class="cline-any cline-yes">1x</span>
|
|
925
|
+
<span class="cline-any cline-yes">1x</span>
|
|
926
|
+
<span class="cline-any cline-neutral"> </span>
|
|
927
|
+
<span class="cline-any cline-yes">1x</span>
|
|
928
|
+
<span class="cline-any cline-neutral"> </span>
|
|
929
|
+
<span class="cline-any cline-neutral"> </span>
|
|
930
|
+
<span class="cline-any cline-yes">1x</span>
|
|
931
|
+
<span class="cline-any cline-yes">1x</span>
|
|
932
|
+
<span class="cline-any cline-neutral"> </span>
|
|
933
|
+
<span class="cline-any cline-yes">1x</span>
|
|
934
|
+
<span class="cline-any cline-neutral"> </span>
|
|
935
|
+
<span class="cline-any cline-yes">1x</span>
|
|
936
|
+
<span class="cline-any cline-neutral"> </span>
|
|
937
|
+
<span class="cline-any cline-neutral"> </span>
|
|
938
|
+
<span class="cline-any cline-neutral"> </span>
|
|
939
|
+
<span class="cline-any cline-yes">1x</span>
|
|
940
|
+
<span class="cline-any cline-yes">1x</span>
|
|
941
|
+
<span class="cline-any cline-yes">1x</span>
|
|
942
|
+
<span class="cline-any cline-neutral"> </span>
|
|
943
|
+
<span class="cline-any cline-yes">1x</span>
|
|
944
|
+
<span class="cline-any cline-neutral"> </span>
|
|
945
|
+
<span class="cline-any cline-yes">1x</span>
|
|
946
|
+
<span class="cline-any cline-neutral"> </span>
|
|
947
|
+
<span class="cline-any cline-neutral"> </span>
|
|
948
|
+
<span class="cline-any cline-yes">1x</span>
|
|
949
|
+
<span class="cline-any cline-yes">1x</span>
|
|
950
|
+
<span class="cline-any cline-neutral"> </span>
|
|
951
|
+
<span class="cline-any cline-yes">1x</span>
|
|
952
|
+
<span class="cline-any cline-neutral"> </span>
|
|
953
|
+
<span class="cline-any cline-yes">1x</span>
|
|
954
|
+
<span class="cline-any cline-neutral"> </span>
|
|
955
|
+
<span class="cline-any cline-neutral"> </span>
|
|
956
|
+
<span class="cline-any cline-neutral"> </span>
|
|
957
|
+
<span class="cline-any cline-yes">1x</span>
|
|
958
|
+
<span class="cline-any cline-yes">1x</span>
|
|
959
|
+
<span class="cline-any cline-yes">1x</span>
|
|
960
|
+
<span class="cline-any cline-neutral"> </span>
|
|
961
|
+
<span class="cline-any cline-yes">1x</span>
|
|
962
|
+
<span class="cline-any cline-neutral"> </span>
|
|
963
|
+
<span class="cline-any cline-yes">1x</span>
|
|
964
|
+
<span class="cline-any cline-neutral"> </span>
|
|
965
|
+
<span class="cline-any cline-neutral"> </span>
|
|
966
|
+
<span class="cline-any cline-yes">1x</span>
|
|
967
|
+
<span class="cline-any cline-yes">1x</span>
|
|
968
|
+
<span class="cline-any cline-neutral"> </span>
|
|
969
|
+
<span class="cline-any cline-yes">1x</span>
|
|
970
|
+
<span class="cline-any cline-neutral"> </span>
|
|
971
|
+
<span class="cline-any cline-neutral"> </span>
|
|
972
|
+
<span class="cline-any cline-neutral"> </span>
|
|
973
|
+
<span class="cline-any cline-yes">1x</span>
|
|
974
|
+
<span class="cline-any cline-yes">1x</span>
|
|
975
|
+
<span class="cline-any cline-yes">1x</span>
|
|
976
|
+
<span class="cline-any cline-neutral"> </span>
|
|
977
|
+
<span class="cline-any cline-yes">1x</span>
|
|
978
|
+
<span class="cline-any cline-neutral"> </span>
|
|
979
|
+
<span class="cline-any cline-yes">1x</span>
|
|
980
|
+
<span class="cline-any cline-neutral"> </span>
|
|
981
|
+
<span class="cline-any cline-neutral"> </span>
|
|
982
|
+
<span class="cline-any cline-yes">1x</span>
|
|
983
|
+
<span class="cline-any cline-yes">1x</span>
|
|
984
|
+
<span class="cline-any cline-neutral"> </span>
|
|
985
|
+
<span class="cline-any cline-yes">1x</span>
|
|
986
|
+
<span class="cline-any cline-neutral"> </span>
|
|
987
|
+
<span class="cline-any cline-neutral"> </span>
|
|
988
|
+
<span class="cline-any cline-neutral"> </span>
|
|
989
|
+
<span class="cline-any cline-yes">1x</span>
|
|
990
|
+
<span class="cline-any cline-yes">1x</span>
|
|
991
|
+
<span class="cline-any cline-yes">1x</span>
|
|
992
|
+
<span class="cline-any cline-neutral"> </span>
|
|
993
|
+
<span class="cline-any cline-yes">1x</span>
|
|
994
|
+
<span class="cline-any cline-neutral"> </span>
|
|
995
|
+
<span class="cline-any cline-yes">1x</span>
|
|
996
|
+
<span class="cline-any cline-neutral"> </span>
|
|
997
|
+
<span class="cline-any cline-neutral"> </span>
|
|
998
|
+
<span class="cline-any cline-yes">1x</span>
|
|
999
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1000
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1001
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1002
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1003
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1004
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1005
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1006
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1007
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1008
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1009
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1010
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1011
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1012
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1013
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1014
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1015
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1016
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1017
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1018
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1019
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1020
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1021
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1022
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1023
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1024
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1025
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1026
|
+
<span class="cline-any cline-neutral"> </span>
|
|
783
1027
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import validations from './validations';
|
|
784
1028
|
|
|
785
1029
|
const chai = require('chai');
|
|
@@ -789,54 +1033,54 @@ const { expect, assert } = chai;
|
|
|
789
1033
|
describe('Validations', () => {
|
|
790
1034
|
describe('global checks', () => {
|
|
791
1035
|
describe('exists', () => {
|
|
792
|
-
it('should return true when passed any value',
|
|
1036
|
+
it('should return true when passed any value', () => validations.exists('x').should.be.true);
|
|
793
1037
|
|
|
794
|
-
it('should return false when not passed a value',
|
|
1038
|
+
it('should return false when not passed a value', () => validations.exists().should.be.false);
|
|
795
1039
|
});
|
|
796
1040
|
|
|
797
1041
|
describe('nonEmpty', () => {
|
|
798
|
-
it('should return true when passed any value with a length',
|
|
1042
|
+
it('should return true when passed any value with a length', () => validations.nonEmpty('x').should.be.true
|
|
799
1043
|
&& validations.nonEmpty(['x']));
|
|
800
1044
|
|
|
801
|
-
it('should return false when passed a value without a length',
|
|
1045
|
+
it('should return false when passed a value without a length', () => validations.nonEmpty().should.be.false
|
|
802
1046
|
&& validations.nonEmpty({}).should.be.false
|
|
803
1047
|
&& validations.nonEmpty(null).should.be.false
|
|
804
1048
|
&& validations.nonEmpty(undefined).should.be.false);
|
|
805
1049
|
});
|
|
806
1050
|
|
|
807
1051
|
describe('isNonEmptyString', () => {
|
|
808
|
-
it('should return true when passed a string of any length',
|
|
1052
|
+
it('should return true when passed a string of any length', () => validations.isNonEmptyString('x').should.be.true
|
|
809
1053
|
&& validations.isNonEmptyString('Do not go gentle into that good night, Old age should burn and rage at close of day; Rage, rage against the dying of the light.').should.be.true);
|
|
810
1054
|
|
|
811
|
-
it('should return false when passed an empty string or something that is not a string',
|
|
1055
|
+
it('should return false when passed an empty string or something that is not a string', () => validations.isNonEmptyString('').should.be.false
|
|
812
1056
|
&& validations.isNonEmptyString(['x']).should.be.false
|
|
813
1057
|
&& validations.isNonEmptyString({ key: 'val' }).should.be.false);
|
|
814
1058
|
});
|
|
815
1059
|
|
|
816
1060
|
describe('ensureShortEnough', () => {
|
|
817
|
-
it('should return true when the given string is shorter in length than the given length',
|
|
1061
|
+
it('should return true when the given string is shorter in length than the given length', () => validations.ensureShortEnough(3, 'foo').should.be.true
|
|
818
1062
|
&& validations.ensureShortEnough(3, 'fo').should.be.true);
|
|
819
1063
|
|
|
820
|
-
it('should throw a BadRequest error if the given string is longer than the given length',
|
|
821
|
-
|
|
1064
|
+
it('should throw a BadRequest error if the given string is longer than the given length', () => {
|
|
1065
|
+
expect(() => validations.ensureShortEnough(3, 'foo!')).to.throw('Max query size exceeded: 4 / 3');
|
|
822
1066
|
});
|
|
823
1067
|
|
|
824
|
-
it('should throw a BadRequest error if the given string is null or undefined',
|
|
825
|
-
|
|
826
|
-
|
|
1068
|
+
it('should throw a BadRequest error if the given string is null or undefined', () => {
|
|
1069
|
+
expect(() => validations.ensureShortEnough(3, null)).to.throw('Max query size exceeded: undefined / 3');
|
|
1070
|
+
expect(() => validations.ensureShortEnough(3, undefined)).to.throw('Max query size exceeded: undefined / 3');
|
|
827
1071
|
});
|
|
828
1072
|
});
|
|
829
1073
|
|
|
830
1074
|
describe('ensure', () => {
|
|
831
|
-
it('should return true if the first argument is not null or undefined',
|
|
1075
|
+
it('should return true if the first argument is not null or undefined', () => validations.ensure('thing', 'Error message').should.be.true
|
|
832
1076
|
&& validations.ensure(['array'], 'Error message').should.be.true
|
|
833
1077
|
&& validations.ensure({ key: 'val' }).should.be.true);
|
|
834
|
-
it('should throw a BadRequest error if the first argument is null or undefined',
|
|
835
|
-
|
|
836
|
-
|
|
1078
|
+
it('should throw a BadRequest error if the first argument is null or undefined', () => {
|
|
1079
|
+
expect(<span class="fstat-no" title="function not covered" >() =</span>> <span class="cstat-no" title="statement not covered" >validations.ensure(null, 'Error message').to.throw('Error message'))</span>;
|
|
1080
|
+
expect(<span class="fstat-no" title="function not covered" >() =</span>> <span class="cstat-no" title="statement not covered" >validations.ensure(undefined, 'Error message').to.throw('Error message'))</span>;
|
|
837
1081
|
});
|
|
838
1082
|
});
|
|
839
|
-
describe
|
|
1083
|
+
describe('isSafeString', () => {
|
|
840
1084
|
it('should return true if the first argument is a safe string', () => {
|
|
841
1085
|
validations.isSafeString('aaaaa').should.be.true;
|
|
842
1086
|
validations.isSafeString('Customer reference').should.be.true;
|
|
@@ -852,298 +1096,420 @@ describe('Validations', () => {
|
|
|
852
1096
|
|
|
853
1097
|
describe('check', () => {
|
|
854
1098
|
describe('matches', () => {
|
|
855
|
-
it('should return true when passed two arrays that exactly match',
|
|
1099
|
+
it('should return true when passed two arrays that exactly match', () => validations.check.matches([1, 2, 3, 4, 5], [1, 2, 3, 4, 5], 'error message').should.be.true);
|
|
856
1100
|
|
|
857
|
-
it('should throw an error when passed two arrays that do not exactly match',
|
|
858
|
-
|
|
1101
|
+
it('should throw an error when passed two arrays that do not exactly match', () => {
|
|
1102
|
+
expect(<span class="fstat-no" title="function not covered" >() =</span>> <span class="cstat-no" title="statement not covered" >validations.check.matches([1, 2, 3, 4], [1, 2, 3, 4, 5], 'Error message').to.throw('Error message'))</span>;
|
|
859
1103
|
});
|
|
860
1104
|
});
|
|
861
1105
|
|
|
862
1106
|
describe('wasFound', () => {
|
|
863
|
-
it('should return the string passed if this is not null',
|
|
864
|
-
|
|
1107
|
+
it('should return the string passed if this is not null', () => {
|
|
1108
|
+
expect(validations.check.wasFound()('string')).to.equal('string');
|
|
865
1109
|
});
|
|
866
|
-
it('should throw an error if the item is null',
|
|
867
|
-
|
|
1110
|
+
it('should throw an error if the item is null', () => {
|
|
1111
|
+
expect(() => validations.check.wasFound('no value')()).to.throw('Unknown no value');
|
|
868
1112
|
});
|
|
869
1113
|
});
|
|
870
1114
|
|
|
871
1115
|
describe('wasCreated', () => {
|
|
872
|
-
it('should return the array passed if it is not empty',
|
|
873
|
-
|
|
1116
|
+
it('should return the array passed if it is not empty', () => {
|
|
1117
|
+
expect(validations.check.wasCreated()([1, 2, 3])).to.eql([1, 2, 3]);
|
|
874
1118
|
});
|
|
875
1119
|
|
|
876
|
-
it('should throw an error if the array is empty',
|
|
877
|
-
|
|
1120
|
+
it('should throw an error if the array is empty', () => {
|
|
1121
|
+
expect(() => validations.check.wasCreated('Oh no! No array!')([])).to.throw('Oh no! No array!');
|
|
878
1122
|
});
|
|
879
1123
|
});
|
|
880
1124
|
|
|
881
1125
|
describe('isTrue', () => {
|
|
882
1126
|
const count = 2;
|
|
883
1127
|
|
|
884
|
-
it('should return true when the first arg is truthy',
|
|
885
|
-
|
|
1128
|
+
it('should return true when the first arg is truthy', () => {
|
|
1129
|
+
assert(validations.check.isTrue(count === 2, 'Count equals 2'), 'isTrue should be false');
|
|
886
1130
|
});
|
|
887
1131
|
|
|
888
|
-
it('should throw an error when the first arg is falsy',
|
|
889
|
-
|
|
1132
|
+
it('should throw an error when the first arg is falsy', () => {
|
|
1133
|
+
expect(() => validations.check.isTrue(count <= 1, 'Count is greater than 1')).to.throw('Count is greater than 1');
|
|
890
1134
|
});
|
|
891
1135
|
});
|
|
892
1136
|
|
|
893
1137
|
describe('isFalse', () => {
|
|
894
1138
|
const count = 2;
|
|
895
1139
|
|
|
896
|
-
it('should return true when the first arg is falsy',
|
|
897
|
-
|
|
1140
|
+
it('should return true when the first arg is falsy', () => {
|
|
1141
|
+
assert(validations.check.isFalse(count === 3, 'Count should not equal 3'), 'isFalse should be true');
|
|
898
1142
|
});
|
|
899
1143
|
|
|
900
|
-
it('should throw an error when the first arg is truthy',
|
|
901
|
-
|
|
1144
|
+
it('should throw an error when the first arg is truthy', () => {
|
|
1145
|
+
expect(() => validations.check.isFalse(count > 1, 'Count should be greater than 1')).to.throw('Count should be greater than 1');
|
|
902
1146
|
});
|
|
903
1147
|
});
|
|
904
1148
|
|
|
905
1149
|
describe('isCustomerReference', () => {
|
|
906
|
-
it('should return true if the string is longer than 0 and less than or equal to 100 characters',
|
|
907
|
-
|
|
908
|
-
|
|
1150
|
+
it('should return true if the string is longer than 0 and less than or equal to 100 characters', () => {
|
|
1151
|
+
assert(validations.isCustomerReference('1'), 'isCustomerReference fails when the string length is 1');
|
|
1152
|
+
assert(validations.isCustomerReference('Spots of sunshine lie on the surface of the water dance, dance, and their reflections wobble.'), 'isCustomerReference fails when the string length is 100');
|
|
909
1153
|
});
|
|
910
1154
|
|
|
911
|
-
it('should return false when passed an empty string or one longer than 100 characters, or a non-string',
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
1155
|
+
it('should return false when passed an empty string or one longer than 100 characters, or a non-string', () => {
|
|
1156
|
+
assert(!validations.isCustomerReference(''), 'isCustomerReference passes when passed an empty string');
|
|
1157
|
+
assert(!validations.isCustomerReference('Little spots of sunshine lie on the surface of the water and dance, dance, and their reflections wobble deliciously over the ceiling;'), 'isCustomerReference passes with string over 100 characters');
|
|
1158
|
+
assert(!validations.isCustomerReference(['array']), 'isCustomerReference passes when passed a non-string');
|
|
915
1159
|
});
|
|
916
1160
|
});
|
|
917
1161
|
|
|
918
1162
|
describe('isCustomerLabelName', () => {
|
|
919
|
-
it('should return true if the string is longer than 0 and less than or equal to 50 characters',
|
|
920
|
-
|
|
921
|
-
|
|
1163
|
+
it('should return true if the string is longer than 0 and less than or equal to 50 characters', () => {
|
|
1164
|
+
assert(validations.isCustomerLabelName('1'), 'isCustomerLabelName fails when the string length is 1');
|
|
1165
|
+
assert(validations.isCustomerLabelName('William Shakespeare was poet, playwright and actor'), 'isCustomerLabelName fails when the string length is 50');
|
|
922
1166
|
});
|
|
923
1167
|
|
|
924
|
-
it('should return false when passed an empty string or one longer than 50 characters, or a non-string',
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
1168
|
+
it('should return false when passed an empty string or one longer than 50 characters, or a non-string', () => {
|
|
1169
|
+
assert(!validations.isCustomerLabelName(''), 'isCustomerLabelName passes when passed an empty string');
|
|
1170
|
+
assert(!validations.isCustomerLabelName("Many of Shakespeare's plays were published in editions of varying quality and accuracy in his lifetime."), 'isCustomerLabelName passes with string over 50 characters');
|
|
1171
|
+
assert(!validations.isCustomerLabelName(['array']), 'isCustomerLabelName passes when passed a non-string');
|
|
928
1172
|
});
|
|
929
1173
|
});
|
|
930
1174
|
});
|
|
931
1175
|
|
|
932
1176
|
describe('BCH', () => {
|
|
933
1177
|
describe('isAddress', () => {
|
|
934
|
-
it('should correctly validate valid BCH addresses',
|
|
1178
|
+
it('should correctly validate valid BCH addresses', () => validations.bitcoinCash.isAddress('bitcoincash:qrrfmt57avxfd2476gqxqq54djtcvjuzjc2qtsrzcw').should.be.true
|
|
935
1179
|
&& validations.bitcoinCash.isAddress('qqrxa0h9jqnc7v4wmj9ysetsp3y7w9l36u8gnnjulq').should.be.true);
|
|
936
1180
|
|
|
937
|
-
it('should correctly validate an incorrect BCH address',
|
|
1181
|
+
it('should correctly validate an incorrect BCH address', () => validations.bitcoinCash.isAddress('qqrxa0h9jqnc7v4wmj3y7w9l36u8gnnjulq').should.be.false);
|
|
938
1182
|
});
|
|
939
1183
|
|
|
940
1184
|
describe('isTxHash', () => {
|
|
941
|
-
it('should correctly validate a valid BCH hash',
|
|
1185
|
+
it('should correctly validate a valid BCH hash', () => validations.bitcoinCash.isTxHash('a32c4d2f9f2e322f19867dbacb7609a1be63c914b8f41775082b50d3ee1a0ce6').should.be.true);
|
|
942
1186
|
|
|
943
|
-
it('should correctly validate an incorrect BCH hash',
|
|
1187
|
+
it('should correctly validate an incorrect BCH hash', () => validations.bitcoinCash.isTxHash('cd1bdc201022ca9386d8757b1c49ecc6ee3769cad2d42ab6e7f9e7bd831').should.be.false);
|
|
944
1188
|
|
|
945
|
-
it('should return false when passed a non-hex string',
|
|
1189
|
+
it('should return false when passed a non-hex string', () => validations.bitcoinCash.isTxHash('Not a hex string!').should.be.false);
|
|
946
1190
|
});
|
|
947
1191
|
});
|
|
948
1192
|
|
|
949
1193
|
describe('BNB', () => {
|
|
950
1194
|
describe('isAddress', () => {
|
|
951
|
-
it('should correctly validate valid BNB addresses',
|
|
1195
|
+
it('should correctly validate valid BNB addresses', () => validations.binanceChain.isAddress('bnb1z35wusfv8twfele77vddclka9z84ugywug48gn').should.be.true);
|
|
952
1196
|
|
|
953
|
-
it('should correctly validate an incorrect BNB address',
|
|
1197
|
+
it('should correctly validate an incorrect BNB address', () => validations.binanceChain.isAddress('bnb1z35wusfv8twfele77vddclka9z84ugywug48gn1').should.be.false);
|
|
954
1198
|
});
|
|
955
1199
|
|
|
956
1200
|
describe('isTxHash', () => {
|
|
957
|
-
it('should correctly validate a valid BNB hash',
|
|
1201
|
+
it('should correctly validate a valid BNB hash', () => validations.binanceChain.isTxHash('E68C2D178F989DE296FA1B513D1AA138B234C436B52E0D755C6664A70F7EEF7B').should.be.true);
|
|
958
1202
|
|
|
959
|
-
it('should correctly validate an incorrect BNB hash',
|
|
1203
|
+
it('should correctly validate an incorrect BNB hash', () => validations.binanceChain.isTxHash('E68C2D178F989DE296FA1B513D1AA138B234C436B52E0D755C6664A70F7EEF7B1').should.be.false);
|
|
960
1204
|
|
|
961
|
-
it('should return false when passed a non-hex string',
|
|
1205
|
+
it('should return false when passed a non-hex string', () => validations.binanceChain.isTxHash('Not a hex string!').should.be.false);
|
|
962
1206
|
});
|
|
963
1207
|
});
|
|
964
1208
|
|
|
965
1209
|
describe('BTC', () => {
|
|
966
1210
|
describe('isAddress', () => {
|
|
967
|
-
it('should correctly validate a valid BTC address',
|
|
1211
|
+
it('should correctly validate a valid BTC address', () => validations.bitcoin.isAddress('1LFnX5KT4CMKud7KB9xaXFZFkD3H8bUD16').should.be.true);
|
|
968
1212
|
|
|
969
|
-
it('should correctly validate an incorrect BTC address',
|
|
1213
|
+
it('should correctly validate an incorrect BTC address', () => validations.bitcoin.isAddress('1LFnX5KT4CMKud7KB9xaXFZFkD3H8b').should.be.false);
|
|
970
1214
|
});
|
|
971
1215
|
|
|
972
1216
|
describe('isBech32Address', () => {
|
|
973
|
-
it('should correctly validate a Bech32 address',
|
|
974
|
-
it('should correctly validate an invalide Bech32 address',
|
|
1217
|
+
it('should correctly validate a Bech32 address', () => validations.bitcoin.isBech32Address('bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq').should.be.true);
|
|
1218
|
+
it('should correctly validate an invalide Bech32 address', () => validations.bitcoin.isBech32Address('4ef47f6eb681d5d9fa2f7e16336cd629303c635e8da51e425b76088be9c8744c').should.be.false);
|
|
975
1219
|
});
|
|
976
1220
|
|
|
977
1221
|
describe('isHDPublicKey', () => {
|
|
978
|
-
it('should return true when passed an HD public key',
|
|
979
|
-
it('should return false when not passed an HD public key',
|
|
1222
|
+
it('should return true when passed an HD public key', () => validations.bitcoin.isHDPublicKey('xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi').should.be.true);
|
|
1223
|
+
it('should return false when not passed an HD public key', () => validations.bitcoin.isHDPublicKey('bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq').should.be.false);
|
|
980
1224
|
});
|
|
981
1225
|
|
|
982
1226
|
describe('isPublicKey', () => {
|
|
983
|
-
it('should return true when passed a public key',
|
|
984
|
-
it('should return false when not passed a public key',
|
|
1227
|
+
it('should return true when passed a public key', () => validations.bitcoin.isPublicKey('046c04c02f1138f440e8c5e9099db938bfba93d0389528bb7f6bf423ae203a2edcfba133f0409023d7ea13ac01c5aeedaf0bbfbeb8b82e9b48410d93a296da5b0c').should.be.true);
|
|
1228
|
+
it('should return false when not passed a public key', () => validations.bitcoin.isPublicKey('1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm').should.be.false);
|
|
985
1229
|
});
|
|
986
1230
|
|
|
987
1231
|
describe('isTxHash', () => {
|
|
988
|
-
it('should correctly validate a valid BTC hash',
|
|
989
|
-
it('should correctly validate an incorrect BTC hash',
|
|
990
|
-
it('should return false if the string passed is not a hex string',
|
|
1232
|
+
it('should correctly validate a valid BTC hash', () => validations.bitcoin.isTxHash('835346f3ea00a23df60ca5dc24afce67810c792ac4505e544410d4b19e7c95a0').should.be.true);
|
|
1233
|
+
it('should correctly validate an incorrect BTC hash', () => validations.bitcoin.isTxHash('835346f3ea00a23df60caafce67810c792ac4505e544410d4b19e7c95a0').should.be.false);
|
|
1234
|
+
it('should return false if the string passed is not a hex string', () => validations.bitcoin.isTxHex('Definitely not a hex string').should.be.false);
|
|
991
1235
|
});
|
|
992
1236
|
|
|
993
1237
|
describe('isTxHex', () => {
|
|
994
1238
|
const hex = '0100000002d8c8df6a6fdd2addaf589a83d860f18b44872d13ee6ec3526b2b470d42a96d4d000000008b483045022100b31557e47191936cb14e013fb421b1860b5e4fd5d2bc5ec1938f4ffb1651dc8902202661c2920771fd29dd91cd4100cefb971269836da4914d970d333861819265ba014104c54f8ea9507f31a05ae325616e3024bd9878cb0a5dff780444002d731577be4e2e69c663ff2da922902a4454841aa1754c1b6292ad7d317150308d8cce0ad7abffffffff2ab3fa4f68a512266134085d3260b94d3b6cfd351450cff021c045a69ba120b2000000008b4830450220230110bc99ef311f1f8bda9d0d968bfe5dfa4af171adbef9ef71678d658823bf022100f956d4fcfa0995a578d84e7e913f9bb1cf5b5be1440bcede07bce9cd5b38115d014104c6ec27cffce0823c3fecb162dbd576c88dd7cda0b7b32b0961188a392b488c94ca174d833ee6a9b71c0996620ae71e799fc7c77901db147fa7d97732e49c8226ffffffff02c0175302000000001976a914a3d89c53bb956f08917b44d113c6b2bcbe0c29b788acc01c3d09000000001976a91408338e1d5e26db3fce21b011795b1c3c8a5a5d0788ac00000000';
|
|
995
|
-
it('should return true if passed a hex string Tx hash',
|
|
996
|
-
it('should return false if the string passed is not a hex string',
|
|
997
|
-
it('should return false if the string passed is a hex string, but is not a tx hash',
|
|
1239
|
+
it('should return true if passed a hex string Tx hash', () => validations.bitcoin.isTxHex(hex).should.be.true);
|
|
1240
|
+
it('should return false if the string passed is not a hex string', () => validations.bitcoin.isTxHex('definitelyNotAHexString').should.be.false);
|
|
1241
|
+
it('should return false if the string passed is a hex string, but is not a tx hash', () => validations.bitcoin.isTxHex('4ef47f6eb681d5d9fa2f7e16336cd629303c635e8da51e425b76088be9c8744c').should.be.false);
|
|
998
1242
|
});
|
|
999
1243
|
|
|
1000
1244
|
describe('isHDPath', () => {
|
|
1001
|
-
it('should return true when passed a valid HDPrivateKey path',
|
|
1002
|
-
it('should return false when passed a string that is not a valid HDPrivateKey path',
|
|
1245
|
+
it('should return true when passed a valid HDPrivateKey path', () => validations.bitcoin.isHDPath('xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi'));
|
|
1246
|
+
it('should return false when passed a string that is not a valid HDPrivateKey path', () => validations.bitcoin.isHDPath('bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq').should.be.false);
|
|
1003
1247
|
});
|
|
1004
1248
|
|
|
1005
1249
|
describe('isScriptHex', () => {
|
|
1006
|
-
it('should return true when passed a script hex',
|
|
1007
|
-
it('should return false if the string passed is not a hex string',
|
|
1008
|
-
it('should return false if the string passed is a hex string, but is not a script hex',
|
|
1250
|
+
it('should return true when passed a script hex', () => validations.bitcoin.isScriptHex('01000000011e2e8cfdf21d68f90974cd557a30c11894cc8cfec5cd5330e41846c2c84566bd000000006b4830450221009f61f453f44e807fdc538ca21710393d34005dd5709dabd8b6b9ccf09ea0b36a0220420d91a33f43d7b979471220e12cd1025975bd2e6c0bf2a14eb65ad89d578104012102de8f92034b9b3c956c1896d23a628537561e29faa772438aac2265c91ede6519ffffffff0118566202000000001976a914b27f04e510293c3e530e7b7bdf71f59118030e1e88ac00000000').should.be.true);
|
|
1251
|
+
it('should return false if the string passed is not a hex string', () => validations.bitcoin.isScriptHex('definitelyNotAHexString').should.be.false);
|
|
1252
|
+
it('should return false if the string passed is a hex string, but is not a script hex', () => validations.bitcoin.isScriptHex('mpXwg4jMtRhuSpVq4xS3HFHmCmWp9NyGKt').should.be.false);
|
|
1009
1253
|
});
|
|
1010
1254
|
|
|
1011
1255
|
describe('isTxSignature', () => {
|
|
1012
|
-
it('should return true when passed a tx hash that includes a signature',
|
|
1013
|
-
it('should return false when passed a tx hash that does not include a signature',
|
|
1014
|
-
it('should return false if the string passed is not a hex string',
|
|
1256
|
+
it('should return true when passed a tx hash that includes a signature', () => validations.bitcoin.isTxSignature('304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d1090db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501').should.be.true);
|
|
1257
|
+
it('should return false when passed a tx hash that does not include a signature', () => validations.bitcoin.isTxSignature('f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6').should.be.false);
|
|
1258
|
+
it('should return false if the string passed is not a hex string', () => validations.bitcoin.isTxSignature('definitelyNotAHexString').should.be.false);
|
|
1015
1259
|
});
|
|
1016
1260
|
|
|
1017
1261
|
describe('isBlockHeight', () => {
|
|
1018
|
-
it('should return true when passed a value greater than or equal to 0',
|
|
1262
|
+
it('should return true when passed a value greater than or equal to 0', () => validations.bitcoin.isBlockHeight(986789).should.be.true
|
|
1019
1263
|
&& validations.bitcoin.isBlockHeight('987654').should.be.true);
|
|
1020
|
-
it('should return false when passed a value that is not greater than or equal to 0',
|
|
1264
|
+
it('should return false when passed a value that is not greater than or equal to 0', () => validations.bitcoin.isBlockHeight(null).should.be.false
|
|
1021
1265
|
&& validations.bitcoin.isBlockHeight('string').should.be.false);
|
|
1022
1266
|
});
|
|
1023
1267
|
});
|
|
1024
1268
|
|
|
1025
1269
|
describe('ETH', () => {
|
|
1026
1270
|
describe('isAddress', () => {
|
|
1027
|
-
it('should return true if the address evaluates as a web3 address',
|
|
1028
|
-
it('should return false if the address does not evaluate to a web3 address',
|
|
1271
|
+
it('should return true if the address evaluates as a web3 address', () => validations.ethereum.isAddress('0xa6Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.true);
|
|
1272
|
+
it('should return false if the address does not evaluate to a web3 address', () => validations.ethereum.isAddress('Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.false);
|
|
1029
1273
|
});
|
|
1030
1274
|
|
|
1031
1275
|
describe('isBlockHash', () => {
|
|
1032
|
-
it('should return true when given a valid hash',
|
|
1033
|
-
it('should return false when given an vinalid hash',
|
|
1276
|
+
it('should return true when given a valid hash', () => validations.ethereum.isBlockHash('0xec6491abd46a1a9a71b78f4b84d96fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.true);
|
|
1277
|
+
it('should return false when given an vinalid hash', () => validations.ethereum.isBlockHash('0xec6491abd46a1a9a71b78f4b84d96fd49525aa4f66c8d8c3588c489eb0e').should.be.false);
|
|
1034
1278
|
});
|
|
1035
1279
|
|
|
1036
1280
|
describe('isTxHash', () => {
|
|
1037
|
-
it('should correctly validate a valid ETH hash',
|
|
1281
|
+
it('should correctly validate a valid ETH hash', () => validations.ethereum.isTxHash('0xec6491abd46a1a9a71b78f4b84d96fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.true);
|
|
1038
1282
|
|
|
1039
|
-
it('should correctly validate an incorrect ETH hash',
|
|
1283
|
+
it('should correctly validate an incorrect ETH hash', () => validations.ethereum.isTxHash('0xec6491abd46a1a9a71b7896fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.false);
|
|
1040
1284
|
});
|
|
1041
1285
|
|
|
1042
1286
|
describe('isAddressCode', () => {
|
|
1043
|
-
it('should return true if the string is a hex address',
|
|
1044
|
-
it('should return false if the string is not a hex address',
|
|
1287
|
+
it('should return true if the string is a hex address', () => validations.ethereum.isAddressCode('0xa6Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.true);
|
|
1288
|
+
it('should return false if the string is not a hex address', () => validations.ethereum.isAddressCode('0xa6Bc4b3fe7F27yu124d30D896Fe4457711e9d214').should.be.false);
|
|
1045
1289
|
});
|
|
1046
1290
|
|
|
1047
1291
|
describe('isValidWeiAmount', () => {
|
|
1048
|
-
it('should return true when passed an amount that evaluates to wei',
|
|
1049
|
-
it('should return false when passed an amount that is not valid in wei',
|
|
1292
|
+
it('should return true when passed an amount that evaluates to wei', () => validations.ethereum.isValidWeiAmount('7000000000000000').should.be.true);
|
|
1293
|
+
it('should return false when passed an amount that is not valid in wei', () => validations.ethereum.isValidWeiAmount(7000000000000000).should.be.false
|
|
1050
1294
|
&& validations.ethereum.isValidWeiAmount('1000.00').should.be.false);
|
|
1051
1295
|
});
|
|
1052
1296
|
});
|
|
1053
1297
|
|
|
1054
1298
|
describe('LTC', () => {
|
|
1055
1299
|
describe('isAddress', () => {
|
|
1056
|
-
it('should correctly validate valid LTC addresses',
|
|
1300
|
+
it('should correctly validate valid LTC addresses', () => validations.litecoin.isAddress('LMR7przNNMS3GpaD6Ygq64NxbsJsZAqGgM').should.be.true);
|
|
1057
1301
|
|
|
1058
|
-
it('should correctly validate
|
|
1302
|
+
it('should correctly validate valid LTC MimbleWimble addresses', () => validations.litecoin.isAddress('ltcmweb1qq2aejfd7svtnqk0uq0cfkd9mr9sszypmx2phdu5qwfhlujazv2nxjqstgy3r5gkxesu5vv2v0tmlwdwhat3se36pwzwtlqm8ypxq3d2fggc8d7nq').should.be.true);
|
|
1303
|
+
|
|
1304
|
+
it('should correctly validate an incorrect LTC address', () => validations.litecoin.isAddress('t1t8BzkNb8d98o8kpbwrjtUjMX3GMF').should.be.false);
|
|
1059
1305
|
});
|
|
1060
1306
|
|
|
1061
1307
|
describe('isTxHash', () => {
|
|
1062
|
-
it('should correctly validate a valid LTC hash',
|
|
1308
|
+
it('should correctly validate a valid LTC hash', () => validations.litecoin.isTxHash('b0b858b34675cc8f851e6a2174295ada574837422538efe9ca83ef405d2faf29').should.be.true);
|
|
1063
1309
|
|
|
1064
|
-
it('should correctly validate an incorrect LTC hash',
|
|
1310
|
+
it('should correctly validate an incorrect LTC hash', () => validations.litecoin.isTxHash('b0b858b34675cc8f851e6a2295ada574837422538efe9ca83ef405d2faf29').should.be.false);
|
|
1065
1311
|
|
|
1066
|
-
it('should return false when passed a non-hex string',
|
|
1312
|
+
it('should return false when passed a non-hex string', () => validations.litecoin.isTxHash('Not a hex code here').should.be.false);
|
|
1067
1313
|
});
|
|
1068
1314
|
});
|
|
1069
1315
|
|
|
1070
1316
|
describe('XLM', () => {
|
|
1071
1317
|
describe('isAddress', () => {
|
|
1072
|
-
it('should correctly validate valid XLM addresses',
|
|
1318
|
+
it('should correctly validate valid XLM addresses', () => validations.stellar.isAddress('GBH4TZYZ4IRCPO44CBOLFUHULU2WGALXTAVESQA6432MBJMABBB4GIYI').should.be.true);
|
|
1073
1319
|
|
|
1074
|
-
it('should correctly validate an incorrect XLM address',
|
|
1320
|
+
it('should correctly validate an incorrect XLM address', () => validations.stellar.isAddress('GBH4TZYZ4IRCPO44CAAAAAAULU2WGALXTAVESQA6432MBJMABBB4GIYI').should.be.false);
|
|
1075
1321
|
});
|
|
1076
1322
|
|
|
1077
1323
|
describe('isTxHash', () => {
|
|
1078
|
-
it('should correctly validate a valid XLM hash',
|
|
1324
|
+
it('should correctly validate a valid XLM hash', () => validations.stellar.isTxHash('dcf208070966a0f04dbff0be6abe5bc7ea2d77f16167e89e1869a8efc68ebe44').should.be.true);
|
|
1079
1325
|
|
|
1080
|
-
it('should correctly validate an incorrect XLM hash',
|
|
1326
|
+
it('should correctly validate an incorrect XLM hash', () => validations.stellar.isTxHash('8ee1f64137b12d07f8d2ddd3460d78ecbe37ba671aa4e54af34de935cc2bba2ca').should.be.false);
|
|
1081
1327
|
|
|
1082
|
-
it('should return false when passed a non-hex string',
|
|
1328
|
+
it('should return false when passed a non-hex string', () => validations.stellar.isTxHash('Yet again this is not a hex string').should.be.false);
|
|
1083
1329
|
});
|
|
1084
1330
|
});
|
|
1085
1331
|
|
|
1086
1332
|
describe('XRP', () => {
|
|
1087
1333
|
describe('isAddress', () => {
|
|
1088
|
-
it('should correctly validate valid XRP addresses',
|
|
1334
|
+
it('should correctly validate valid XRP addresses', () => validations.ripple.isAddress('rDV3RhpWznRCmtpD17RNxg6t4Hg8NPV8mF').should.be.true);
|
|
1089
1335
|
|
|
1090
|
-
it('should correctly validate an incorrect XRP address',
|
|
1336
|
+
it('should correctly validate an incorrect XRP address', () => validations.ripple.isAddress('rDV3RhpWznRCmtpD17RNxg0t4Hg8NPV8mF').should.be.false);
|
|
1091
1337
|
});
|
|
1092
1338
|
|
|
1093
1339
|
describe('isTxHash', () => {
|
|
1094
|
-
it('should correctly validate a valid XRP hash',
|
|
1340
|
+
it('should correctly validate a valid XRP hash', () => validations.ripple.isTxHash('C6593DD2A32ED5120DF1FE80665B84A9CCAF06ADDC2EF89F720CBAC3E8069C0E').should.be.true);
|
|
1095
1341
|
|
|
1096
|
-
it('should correctly validate an incorrect XRP hash',
|
|
1342
|
+
it('should correctly validate an incorrect XRP hash', () => validations.ripple.isTxHash('C6593DD2A32ED5120DF1FE84A9CCAF06ADDC2EF89F720CBAC3E8069C0E').should.be.false);
|
|
1097
1343
|
|
|
1098
|
-
it('should return false when passed a non-hex string',
|
|
1344
|
+
it('should return false when passed a non-hex string', () => validations.ripple.isTxHash('Yet again this is not a hex string').should.be.false);
|
|
1099
1345
|
});
|
|
1100
1346
|
});
|
|
1101
1347
|
|
|
1102
1348
|
describe('ZEC', () => {
|
|
1103
1349
|
describe('isAddress', () => {
|
|
1104
|
-
it('should correctly validate valid ZEC addresses',
|
|
1350
|
+
it('should correctly validate valid ZEC addresses', () => validations.zcash.isAddress('t1Jxptj7GnXQRsLNH5wWnDrGwEipEB3aZtf').should.be.true);
|
|
1105
1351
|
|
|
1106
|
-
it('should correctly validate an incorrect ZEC address',
|
|
1352
|
+
it('should correctly validate an incorrect ZEC address', () => validations.zcash.isAddress('t1Jxptj7GnXQRsLNH5wWnDrGwEipEB3aZtf1').should.be.false);
|
|
1107
1353
|
});
|
|
1108
1354
|
|
|
1109
1355
|
describe('isTxHash', () => {
|
|
1110
|
-
it('should correctly validate a valid ZEC hash',
|
|
1356
|
+
it('should correctly validate a valid ZEC hash', () => validations.zcash.isTxHash('715c23949b85581de432f174a9e7f4d3f9e74b008064e2c68e7a52b1ec38e961').should.be.true);
|
|
1111
1357
|
|
|
1112
|
-
it('should correctly validate an incorrect ZEC hash',
|
|
1358
|
+
it('should correctly validate an incorrect ZEC hash', () => validations.zcash.isTxHash('715c23949b85581de432f174a9e7f4d3f9e74b008064e2c68e7a52b1ec38e9611').should.be.false);
|
|
1113
1359
|
|
|
1114
|
-
it('should return false when passed a non-hex string',
|
|
1360
|
+
it('should return false when passed a non-hex string', () => validations.zcash.isTxHash('Yet again this is not a hex string').should.be.false);
|
|
1115
1361
|
});
|
|
1116
1362
|
});
|
|
1117
1363
|
|
|
1118
1364
|
describe('ZEN', () => {
|
|
1119
1365
|
describe('isAddress', () => {
|
|
1120
|
-
it('should correctly validate valid ZEN addresses',
|
|
1366
|
+
it('should correctly validate valid ZEN addresses', () => validations.horizen.isAddress('znUovxhrE91tep6D7YtgSc3XJZoYQLVDwVn').should.be.true);
|
|
1121
1367
|
|
|
1122
|
-
it('should correctly validate an incorrect ZEN address',
|
|
1368
|
+
it('should correctly validate an incorrect ZEN address', () => validations.horizen.isAddress('znUovxhrE91tep6D7YtgSc3XJZoYQLVDwVn1').should.be.false);
|
|
1123
1369
|
});
|
|
1124
1370
|
|
|
1125
1371
|
describe('isTxHash', () => {
|
|
1126
|
-
it('should correctly validate a valid ZEN hash',
|
|
1372
|
+
it('should correctly validate a valid ZEN hash', () => validations.horizen.isTxHash('e5d31deb3fee023758f0b79d06489df975fce9aa53351b9b5c8491e4c33c74b7').should.be.true);
|
|
1127
1373
|
|
|
1128
|
-
it('should correctly validate an incorrect ZEN hash',
|
|
1374
|
+
it('should correctly validate an incorrect ZEN hash', () => validations.horizen.isTxHash('e5d31deb3fee023758f0b79d06489df975fce9aa53351b9b5c8491e4c33c74b71').should.be.false);
|
|
1129
1375
|
|
|
1130
|
-
it('should return false when passed a non-hex string',
|
|
1376
|
+
it('should return false when passed a non-hex string', () => validations.horizen.isTxHash('Yet again this is not a hex string').should.be.false);
|
|
1131
1377
|
});
|
|
1132
1378
|
});
|
|
1133
1379
|
|
|
1134
1380
|
describe('ZIL', () => {
|
|
1135
1381
|
describe('isAddress', () => {
|
|
1136
|
-
it('should correctly validate valid ZIL addresses',
|
|
1382
|
+
it('should correctly validate valid ZIL addresses', () => validations.zilliqa.isAddress('zil1tw5rpejf96e76ty93l7c3dn0g79h2qhhdm28a4').should.be.true);
|
|
1383
|
+
|
|
1384
|
+
it('should correctly validate an incorrect ZIL address', () => validations.zilliqa.isAddress('0x14456246cc53d31f0a2EB00FA0248F7aEbD3fa8').should.be.false);
|
|
1385
|
+
});
|
|
1386
|
+
|
|
1387
|
+
describe('isTxHash', () => {
|
|
1388
|
+
it('should correctly validate a valid ZIL hash', () => validations.zilliqa.isTxHash('0xb9a04481c546258e339f8ce4cccdee3f179cc37a8f099f0608baf39e0a819f75').should.be.true);
|
|
1389
|
+
|
|
1390
|
+
it('should correctly validate an incorrect ZIL hash', () => validations.zilliqa.isTxHash('0xb9a04481c546258e339f8ce4cccdee3f179cc37a8f099f0608baf39e0a819f7').should.be.false);
|
|
1391
|
+
|
|
1392
|
+
it('should return false when passed a non-hex string', () => validations.zilliqa.isTxHash('Yet again this is not a hex string').should.be.false);
|
|
1393
|
+
});
|
|
1394
|
+
});
|
|
1395
|
+
|
|
1396
|
+
describe('ALGO', () => {
|
|
1397
|
+
describe('isAddress', () => {
|
|
1398
|
+
it('should correctly validate valid ALGO addresses', () => validations.algorand.isAddress('GX3XLHSRMFTADVKJBBQBTZ6BKINW6ZO5JHXWGCWB4CPDNPDQ2PIYN4AVHQ').should.be.true);
|
|
1399
|
+
|
|
1400
|
+
it('should correctly validate an incorrect ALGO address', () => validations.algorand.isAddress('GX3XLHBQBTZ6BKINW6ZO5JHXWGCWB4CPDNPDQ2PIYN4AVHQ').should.be.false);
|
|
1401
|
+
});
|
|
1402
|
+
|
|
1403
|
+
describe('isTxHash', () => {
|
|
1404
|
+
it('should correctly validate a valid ALGO hash', () => validations.algorand.isTxHash('TDITWGH5FODF2EUSKBAZ4DDC323NDBCBCE6BSXVXTZBINTCVQVVQ').should.be.true);
|
|
1405
|
+
|
|
1406
|
+
it('should correctly validate an incorrect ALGO hash', () => validations.algorand.isTxHash('TDITWGH5FOBAZ4DDC323NDBCBCE6BSXVXTZBINTCVQVVQ').should.be.false);
|
|
1407
|
+
|
|
1408
|
+
it('should return false when passed a non-hex string', () => validations.algorand.isTxHash('Yet again this is not a hex string').should.be.false);
|
|
1409
|
+
});
|
|
1410
|
+
});
|
|
1411
|
+
|
|
1412
|
+
describe('DOT', () => {
|
|
1413
|
+
describe('isAddress', () => {
|
|
1414
|
+
it('should correctly validate valid DOT addresses', () => validations.polkadot.isAddress('14YJztsPZEiKuKhU3qLd6JjiY4awfdUru8Xu7BDdZAUuG8S6').should.be.true);
|
|
1415
|
+
|
|
1416
|
+
it('should correctly validate an incorrect DOT address', () => validations.polkadot.isAddress('14YJztsPZEiKuKjiY4awfdUru8Xu7BDdZAUuG8S6').should.be.false);
|
|
1417
|
+
});
|
|
1418
|
+
|
|
1419
|
+
describe('isTxHash', () => {
|
|
1420
|
+
it('should correctly validate a valid DOT hash', () => validations.polkadot.isTxHash('0x975ba4cfd83dd7f4f6e2c1932f4aeb650391f00d57c3856907d668a99fd90609').should.be.true);
|
|
1421
|
+
|
|
1422
|
+
it('should correctly validate an incorrect DOT hash', () => validations.polkadot.isTxHash('0x975ba4cfd83dd7f4f2f4aeb650391f00d57c3856907d668a99fd90609').should.be.false);
|
|
1423
|
+
|
|
1424
|
+
it('should return false when passed a non-hex string', () => validations.polkadot.isTxHash('Yet again this is not a hex string').should.be.false);
|
|
1425
|
+
});
|
|
1426
|
+
});
|
|
1427
|
+
|
|
1428
|
+
describe('ATOM', () => {
|
|
1429
|
+
describe('isAddress', () => {
|
|
1430
|
+
it('should correctly validate valid ATOM addresses', () => validations.cosmos.isAddress('cosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x5').should.be.true);
|
|
1431
|
+
|
|
1432
|
+
it('should correctly validate an incorrect ATOM address', () => validations.cosmos.isAddress('kosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x5').should.be.false);
|
|
1433
|
+
|
|
1434
|
+
it('should correctly validate an incorrect (too long) ATOM address', () => validations.cosmos.isAddress('cosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x50').should.be.false);
|
|
1435
|
+
});
|
|
1436
|
+
|
|
1437
|
+
describe('isTxHash', () => {
|
|
1438
|
+
it('should correctly validate a valid ATOM hash', () => validations.cosmos.isTxHash('BFA0252193CCAA0592AF2A27541473E7F6422A9AD85CFC9525CF67FA2AA2CD6F').should.be.true);
|
|
1439
|
+
|
|
1440
|
+
it('should correctly validate an incorrect ATOM hash', () => validations.cosmos.isTxHash('BFA0252193CCAA0592AF2A27541473E7').should.be.false);
|
|
1441
|
+
|
|
1442
|
+
it('should return false when passed a non-hex string', () => validations.cosmos.isTxHash('ZZA0252193CCAA0592AF2A27541473E7F6422A9AD85CFC9525CF67FA2AA2CD6F').should.be.false);
|
|
1443
|
+
});
|
|
1444
|
+
});
|
|
1445
|
+
|
|
1446
|
+
describe('SOL', () => {
|
|
1447
|
+
describe('isAddress', () => {
|
|
1448
|
+
it('should correctly validate valid SOL addresses', () => validations.solana.isAddress('A4JXQF7p9sHR5apRy2hVgKFAHHs7jdpQv9kFGLDit24T').should.be.true);
|
|
1449
|
+
|
|
1450
|
+
it('should correctly validate an incorrect SOL address', () => validations.solana.isAddress('L0JXQF7p9sHR5apRy2hVgKFAHHs7jdpQv9kFGLDit24T').should.be.false);
|
|
1451
|
+
|
|
1452
|
+
it('should correctly validate an incorrect (too long) SOL address', () => validations.solana.isAddress('A4JXQF7p9sHR5apRy2hVgKFAHHs7jdpQv9kFGLDit24TAAAAAAAAAAAAAAA').should.be.false);
|
|
1453
|
+
});
|
|
1454
|
+
|
|
1455
|
+
describe('isTxHash', () => {
|
|
1456
|
+
it('should correctly validate a valid SOL hash', () => validations.solana.isTxHash('2WcPszZnXBLpu9WzLbGRfwzETPHfTRi4E8fmVedFT4bPYc1BiELG3Ldway6oPTSXpVJZRM4mqEdz2Uuh5n9VQp8x').should.be.true);
|
|
1457
|
+
|
|
1458
|
+
it('should correctly validate an incorrect SOL hash', () => validations.solana.isTxHash('2WcPszZnXBLpu9WzLbGRfwzET').should.be.false);
|
|
1459
|
+
});
|
|
1460
|
+
});
|
|
1461
|
+
|
|
1462
|
+
describe('BSC', () => {
|
|
1463
|
+
describe('isAddress', () => {
|
|
1464
|
+
it('should correctly validate valid BSC addresses', () => validations.binanceSmartChain.isAddress('0x5616e2b8acff064bf902b8a93cbd5da2ca1edc7c').should.be.true);
|
|
1465
|
+
|
|
1466
|
+
it('should correctly validate an incorrect BSC address', () => validations.binanceSmartChain.isAddress('0xz616e2b8acff064bf902b8a93cbd5da2ca1edc7c').should.be.false);
|
|
1467
|
+
|
|
1468
|
+
it('should correctly validate an incorrect (too long) BSC address', () => validations.binanceSmartChain.isAddress('0x5616e2b8acff064bf902b8a93cbd5da2ca1edc7caaaaa').should.be.false);
|
|
1469
|
+
});
|
|
1470
|
+
|
|
1471
|
+
describe('isTxHash', () => {
|
|
1472
|
+
it('should correctly validate a valid BSC hash', () => validations.binanceSmartChain.isTxHash('0x1a17145af3bec32f653d8ebd4c2c1b800214b17a7f8abfdda020cb1f39abe269').should.be.true);
|
|
1473
|
+
|
|
1474
|
+
it('should correctly validate an incorrect BSC hash', () => validations.binanceSmartChain.isTxHash('0x1a17145af3bec32f653d8ebd4c2c1b800214b17').should.be.false);
|
|
1475
|
+
});
|
|
1476
|
+
});
|
|
1477
|
+
|
|
1478
|
+
describe('Polygon', () => {
|
|
1479
|
+
describe('isAddress', () => {
|
|
1480
|
+
it('should correctly validate valid Polygon addresses', () => validations.polygon.isAddress('0x286c2bd6e0585f396647cbfdbfe14b92600365bb').should.be.true);
|
|
1481
|
+
|
|
1482
|
+
it('should correctly validate an incorrect Polygon address', () => validations.polygon.isAddress('0xz286c2bd6e0585f396647cbfdbfe14b92600365bb').should.be.false);
|
|
1483
|
+
|
|
1484
|
+
it('should correctly validate an incorrect (too long) Polygon address', () => validations.polygon.isAddress('0x286c2bd6e0585f396647cbfdbfe14b92600365bba').should.be.false);
|
|
1485
|
+
});
|
|
1486
|
+
|
|
1487
|
+
describe('isTxHash', () => {
|
|
1488
|
+
it('should correctly validate a valid Polygon hash', () => validations.polygon.isTxHash('0x45a491048477568dd2047a0a9b6be9cc491382e74823ea1bd53bbc67db54a867').should.be.true);
|
|
1489
|
+
|
|
1490
|
+
it('should correctly validate an incorrect Polygon hash', () => validations.polygon.isTxHash('0x45a491048477568dd2047a0a9b6be9cc491382e74823e').should.be.false);
|
|
1491
|
+
});
|
|
1492
|
+
});
|
|
1493
|
+
|
|
1494
|
+
describe('Filecoin', () => {
|
|
1495
|
+
describe('isAddress', () => {
|
|
1496
|
+
it('should correctly validate a valid Filecoin f0 address', () => validations.filecoin.isAddress('f01825161').should.be.true);
|
|
1497
|
+
|
|
1498
|
+
it('should correctly validate a valid Filecoin f1 address', () => validations.filecoin.isAddress('f1xafi3wsh7q553efnumhgeomathrehwwd2mye7oy').should.be.true);
|
|
1499
|
+
|
|
1500
|
+
it('should correctly validate a valid Filecoin f2 address', () => validations.filecoin.isAddress('f2vrab2ft4qc22mgfxgdrphd7ovvz6zs3nq3fv4oy').should.be.true);
|
|
1501
|
+
|
|
1502
|
+
it('should correctly validate a valid Filecoin f3 address', () => validations.filecoin.isAddress('f3ug2ti4finql5bxyl5q56udn5lt462miuadjg3ur467wrj6bvbrksglxyv65zoxyz4mgte3joyce3oxkk4q7q').should.be.true);
|
|
1137
1503
|
|
|
1138
|
-
it('should correctly validate an
|
|
1504
|
+
it('should correctly validate an invalid Filecoin address', () => validations.filecoin.isAddress('f4zvcxzvcxzvczvcasdgwere').should.be.false);
|
|
1139
1505
|
});
|
|
1140
1506
|
|
|
1141
1507
|
describe('isTxHash', () => {
|
|
1142
|
-
it('should correctly validate a valid
|
|
1508
|
+
it('should correctly validate a valid Filecoin hash', () => validations.filecoin.isTxHash('bafy2bzacedcrpcs76f2ws445wnjix2kktsgca4vv6qbd7zua7pc5mnkpveg7m').should.be.true);
|
|
1143
1509
|
|
|
1144
|
-
it('should correctly validate an
|
|
1510
|
+
it('should correctly validate an invalid Filecoin hash', () => validations.filecoin.isTxHash('bafy2bzacedcrpcs76f2ws445wnjix2kktsgca4vv6qbd7zua7pc5mnkpveg7').should.be.false);
|
|
1145
1511
|
|
|
1146
|
-
it('should
|
|
1512
|
+
it('should correctly validate an invalid Filecoin hash', () => validations.filecoin.isTxHash('fafy2bzacedcrpcs76f2ws445wnjix2kktsgca4vv6qbd7zua7pc5mnkpveg7m').should.be.false);
|
|
1147
1513
|
});
|
|
1148
1514
|
});
|
|
1149
1515
|
});
|
|
@@ -1153,7 +1519,7 @@ describe('Validations', () => {
|
|
|
1153
1519
|
</div><!-- /wrapper -->
|
|
1154
1520
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1155
1521
|
Code coverage
|
|
1156
|
-
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at
|
|
1522
|
+
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Tue Oct 18 2022 17:03:56 GMT+0200 (CEST)
|
|
1157
1523
|
</div>
|
|
1158
1524
|
</div>
|
|
1159
1525
|
<script src="../prettify.js"></script>
|