@@ -407,6 +407,42 @@ describe('#unit BoltProtocolV5x0', () => {
407
407
[ 'Time' , new Time ( 1 , 1 , 1 , 1 , 1 ) ] ,
408
408
[ 'Date' , new Date ( 1 , 1 , 1 ) ] ,
409
409
[ 'LocalDateTime' , new LocalDateTime ( 1 , 1 , 1 , 1 , 1 , 1 , 1 ) ] ,
410
+ [
411
+ 'DateTimeWithZoneOffset' ,
412
+ new DateTime ( 2022 , 6 , 14 , 15 , 21 , 18 , 183_000_000 , 120 * 60 )
413
+ ] ,
414
+ [
415
+ 'DateTimeWithZoneId / Berlin 2:30 CET' ,
416
+ new DateTime ( 2022 , 10 , 30 , 2 , 30 , 0 , 183_000_000 , 2 * 60 * 60 , 'Europe/Berlin' )
417
+ ] ,
418
+ [
419
+ 'DateTimeWithZoneId / Berlin 2:30 CEST' ,
420
+ new DateTime ( 2022 , 10 , 30 , 2 , 30 , 0 , 183_000_000 , 1 * 60 * 60 , 'Europe/Berlin' )
421
+ ] ,
422
+ [ 'Point2D' , new Point ( 1 , 1 , 1 ) ] ,
423
+ [ 'Point3D' , new Point ( 1 , 1 , 1 , 1 ) ]
424
+ ] ) ( 'should pack spatial types and temporal types (%s)' , ( _ , object ) => {
425
+ const buffer = alloc ( 256 )
426
+ const protocol = new BoltProtocolV5x0 (
427
+ new utils . MessageRecordingConnection ( ) ,
428
+ buffer ,
429
+ {
430
+ disableLosslessIntegers : true
431
+ }
432
+ )
433
+
434
+ const packable = protocol . packable ( object )
435
+
436
+ expect ( packable ) . not . toThrow ( )
437
+
438
+ buffer . reset ( )
439
+
440
+ const unpacked = protocol . unpack ( buffer )
441
+
442
+ expect ( unpacked ) . toEqual ( object )
443
+ } )
444
+
445
+ it . each ( [
410
446
[
411
447
'DateTimeWithZoneId / Australia' ,
412
448
new DateTime ( 2022 , 6 , 15 , 15 , 21 , 18 , 183_000_000 , undefined , 'Australia/Eucla' )
@@ -478,14 +514,8 @@ describe('#unit BoltProtocolV5x0', () => {
478
514
[
479
515
'DateTimeWithZoneId / Sao Paulo just 1 after turn winter time' ,
480
516
new DateTime ( 2019 , 2 , 18 , 1 , 0 , 0 , 183_000_000 , undefined , 'America/Sao_Paulo' )
481
- ] ,
482
- [
483
- 'DateTimeWithZoneOffset' ,
484
- new DateTime ( 2022 , 6 , 14 , 15 , 21 , 18 , 183_000_000 , 120 * 60 )
485
- ] ,
486
- [ 'Point2D' , new Point ( 1 , 1 , 1 ) ] ,
487
- [ 'Point3D' , new Point ( 1 , 1 , 1 , 1 ) ]
488
- ] ) ( 'should pack spatial types and temporal types (%s)' , ( _ , object ) => {
517
+ ]
518
+ ] ) ( 'should pack and unpack DateTimeWithZoneId and without offset (%s)' , ( _ , object ) => {
489
519
const buffer = alloc ( 256 )
490
520
const protocol = new BoltProtocolV5x0 (
491
521
new utils . MessageRecordingConnection ( ) ,
@@ -502,7 +532,22 @@ describe('#unit BoltProtocolV5x0', () => {
502
532
buffer . reset ( )
503
533
504
534
const unpacked = protocol . unpack ( buffer )
505
- expect ( unpacked ) . toEqual ( object )
535
+
536
+ expect ( unpacked . timeZoneOffsetSeconds ) . toBeDefined ( )
537
+
538
+ const unpackedDateTimeWithoutOffset = new DateTime (
539
+ unpacked . year ,
540
+ unpacked . month ,
541
+ unpacked . day ,
542
+ unpacked . hour ,
543
+ unpacked . minute ,
544
+ unpacked . second ,
545
+ unpacked . nanosecond ,
546
+ undefined ,
547
+ unpacked . timeZoneId
548
+ )
549
+
550
+ expect ( unpackedDateTimeWithoutOffset ) . toEqual ( object )
506
551
} )
507
552
} )
508
553
@@ -774,14 +819,14 @@ describe('#unit BoltProtocolV5x0', () => {
774
819
new structure . Structure ( 0x69 , [
775
820
1655212878 , 183_000_000 , 'Europe/Berlin'
776
821
] ) ,
777
- new DateTime ( 2022 , 6 , 14 , 15 , 21 , 18 , 183_000_000 , undefined , 'Europe/Berlin' )
822
+ new DateTime ( 2022 , 6 , 14 , 15 , 21 , 18 , 183_000_000 , 2 * 60 * 60 , 'Europe/Berlin' )
778
823
] ,
779
824
[
780
825
'DateTimeWithZoneId / Australia' ,
781
826
new structure . Structure ( 0x69 , [
782
827
1655212878 , 183_000_000 , 'Australia/Eucla'
783
828
] ) ,
784
- new DateTime ( 2022 , 6 , 14 , 22 , 6 , 18 , 183_000_000 , undefined , 'Australia/Eucla' )
829
+ new DateTime ( 2022 , 6 , 14 , 22 , 6 , 18 , 183_000_000 , 8 * 60 * 60 + 45 * 60 , 'Australia/Eucla' )
785
830
]
786
831
] ) ( 'should unpack spatial types and temporal types (%s)' , ( _ , struct , object ) => {
787
832
const buffer = alloc ( 256 )
0 commit comments