@@ -513,7 +513,7 @@ describe('temporal-types', () => {
513513 } ) ;
514514
515515 it ( 'should expose local date-time components in date-time with zone ID' , ( ) => {
516- const zonedDateTime = dateTimeWithZoneId ( 2356 , 7 , 29 , 23 , 32 , 11 , 9346458 , 3600 , randomZoneId ( ) ) ;
516+ const zonedDateTime = dateTimeWithZoneId ( 2356 , 7 , 29 , 23 , 32 , 11 , 9346458 , randomZoneId ( ) ) ;
517517
518518 expect ( zonedDateTime . year ) . toEqual ( neo4j . int ( 2356 ) ) ;
519519 expect ( zonedDateTime . month ) . toEqual ( neo4j . int ( 7 ) ) ;
@@ -597,6 +597,67 @@ describe('temporal-types', () => {
597597 expect ( duration6 . nanoseconds ) . toEqual ( neo4j . int ( 876543001 ) ) ;
598598 } ) ;
599599
600+ it ( 'should validate types of constructor arguments for Duration' , ( ) => {
601+ expect ( ( ) => new neo4j . types . Duration ( '1' , 2 , 3 , 4 ) ) . toThrowError ( TypeError ) ;
602+ expect ( ( ) => new neo4j . types . Duration ( 1 , '2' , 3 , 4 ) ) . toThrowError ( TypeError ) ;
603+ expect ( ( ) => new neo4j . types . Duration ( 1 , 2 , [ 3 ] , 4 ) ) . toThrowError ( TypeError ) ;
604+ expect ( ( ) => new neo4j . types . Duration ( 1 , 2 , 3 , { value : 4 } ) ) . toThrowError ( TypeError ) ;
605+ expect ( ( ) => new neo4j . types . Duration ( { months : 1 , days : 2 , seconds : 3 , nanoseconds : 4 } ) ) . toThrowError ( TypeError ) ;
606+ } ) ;
607+
608+ it ( 'should validate types of constructor arguments for LocalTime' , ( ) => {
609+ expect ( ( ) => new neo4j . types . LocalTime ( '1' , 2 , 3 , 4 ) ) . toThrowError ( TypeError ) ;
610+ expect ( ( ) => new neo4j . types . LocalTime ( 1 , '2' , 3 , 4 ) ) . toThrowError ( TypeError ) ;
611+ expect ( ( ) => new neo4j . types . LocalTime ( 1 , 2 , [ 3 ] , 4 ) ) . toThrowError ( TypeError ) ;
612+ expect ( ( ) => new neo4j . types . LocalTime ( 1 , 2 , 3 , { value : 4 } ) ) . toThrowError ( TypeError ) ;
613+ expect ( ( ) => new neo4j . types . LocalTime ( { hour : 1 , minute : 2 , seconds : 3 , nanosecond : 4 } ) ) . toThrowError ( TypeError ) ;
614+ } ) ;
615+
616+ it ( 'should validate types of constructor arguments for Time' , ( ) => {
617+ expect ( ( ) => new neo4j . types . Time ( '1' , 2 , 3 , 4 , 5 ) ) . toThrowError ( TypeError ) ;
618+ expect ( ( ) => new neo4j . types . Time ( 1 , '2' , 3 , 4 , 5 ) ) . toThrowError ( TypeError ) ;
619+ expect ( ( ) => new neo4j . types . Time ( 1 , 2 , [ 3 ] , 4 , 5 ) ) . toThrowError ( TypeError ) ;
620+ expect ( ( ) => new neo4j . types . Time ( 1 , 2 , 3 , { value : 4 } , 5 ) ) . toThrowError ( TypeError ) ;
621+ expect ( ( ) => new neo4j . types . Time ( 1 , 2 , 3 , 4 , ( ) => 5 ) ) . toThrowError ( TypeError ) ;
622+ expect ( ( ) => new neo4j . types . Time ( { hour : 1 , minute : 2 , seconds : 3 , nanosecond : 4 , timeZoneOffsetSeconds : 5 } ) ) . toThrowError ( TypeError ) ;
623+ } ) ;
624+
625+ it ( 'should validate types of constructor arguments for Date' , ( ) => {
626+ expect ( ( ) => new neo4j . types . Date ( '1' , 2 , 3 ) ) . toThrowError ( TypeError ) ;
627+ expect ( ( ) => new neo4j . types . Date ( 1 , [ 2 ] , 3 ) ) . toThrowError ( TypeError ) ;
628+ expect ( ( ) => new neo4j . types . Date ( 1 , 2 , ( ) => 3 ) ) . toThrowError ( TypeError ) ;
629+ expect ( ( ) => new neo4j . types . Date ( { year : 1 , month : 2 , day : 3 } ) ) . toThrowError ( TypeError ) ;
630+ } ) ;
631+
632+ it ( 'should validate types of constructor arguments for LocalDateTime' , ( ) => {
633+ expect ( ( ) => new neo4j . types . LocalDateTime ( '1' , 2 , 3 , 4 , 5 , 6 , 7 ) ) . toThrowError ( TypeError ) ;
634+ expect ( ( ) => new neo4j . types . LocalDateTime ( 1 , '2' , 3 , 4 , 5 , 6 , 7 ) ) . toThrowError ( TypeError ) ;
635+ expect ( ( ) => new neo4j . types . LocalDateTime ( 1 , 2 , [ 3 ] , 4 , 5 , 6 , 7 ) ) . toThrowError ( TypeError ) ;
636+ expect ( ( ) => new neo4j . types . LocalDateTime ( 1 , 2 , 3 , [ 4 ] , 5 , 6 , 7 ) ) . toThrowError ( TypeError ) ;
637+ expect ( ( ) => new neo4j . types . LocalDateTime ( 1 , 2 , 3 , 4 , ( ) => 5 , 6 , 7 ) ) . toThrowError ( TypeError ) ;
638+ expect ( ( ) => new neo4j . types . LocalDateTime ( 1 , 2 , 3 , 4 , 5 , ( ) => 6 , 7 ) ) . toThrowError ( TypeError ) ;
639+ expect ( ( ) => new neo4j . types . LocalDateTime ( 1 , 2 , 3 , 4 , 5 , 6 , { value : 7 } ) ) . toThrowError ( TypeError ) ;
640+ expect ( ( ) => new neo4j . types . LocalDateTime ( { year : 1 , month : 2 , day : 3 , hour : 4 , minute : 5 , second : 6 , nanosecond : 7 } ) ) . toThrowError ( TypeError ) ;
641+ } ) ;
642+
643+ it ( 'should validate types of constructor arguments for DateTime' , ( ) => {
644+ expect ( ( ) => new neo4j . types . DateTime ( '1' , 2 , 3 , 4 , 5 , 6 , 7 , 8 ) ) . toThrowError ( TypeError ) ;
645+ expect ( ( ) => new neo4j . types . DateTime ( 1 , '2' , 3 , 4 , 5 , 6 , 7 , 8 ) ) . toThrowError ( TypeError ) ;
646+ expect ( ( ) => new neo4j . types . DateTime ( 1 , 2 , [ 3 ] , 4 , 5 , 6 , 7 , 8 ) ) . toThrowError ( TypeError ) ;
647+ expect ( ( ) => new neo4j . types . DateTime ( 1 , 2 , 3 , [ 4 ] , 5 , 6 , 7 , 8 ) ) . toThrowError ( TypeError ) ;
648+ expect ( ( ) => new neo4j . types . DateTime ( 1 , 2 , 3 , 4 , ( ) => 5 , 6 , 7 , 8 ) ) . toThrowError ( TypeError ) ;
649+ expect ( ( ) => new neo4j . types . DateTime ( 1 , 2 , 3 , 4 , 5 , ( ) => 6 , 7 , 8 ) ) . toThrowError ( TypeError ) ;
650+ expect ( ( ) => new neo4j . types . DateTime ( 1 , 2 , 3 , 4 , 5 , 6 , { value : 7 } , 8 ) ) . toThrowError ( TypeError ) ;
651+ expect ( ( ) => new neo4j . types . DateTime ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , { value : 8 } ) ) . toThrowError ( TypeError ) ;
652+
653+ expect ( ( ) => new neo4j . types . DateTime ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , null , { timeZoneId : 'UK' } ) ) . toThrowError ( TypeError ) ;
654+ expect ( ( ) => new neo4j . types . DateTime ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , null , [ 'UK' ] ) ) . toThrowError ( TypeError ) ;
655+
656+ expect ( ( ) => new neo4j . types . DateTime ( 1 , 2 , 3 , 4 , 5 , 6 , 7 ) ) . toThrow ( ) ;
657+ expect ( ( ) => new neo4j . types . DateTime ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , null , null ) ) . toThrow ( ) ;
658+ expect ( ( ) => new neo4j . types . DateTime ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 'UK' ) ) . toThrow ( ) ;
659+ } ) ;
660+
600661 function testSendAndReceiveRandomTemporalValues ( valueGenerator , done ) {
601662 const asyncFunction = ( index , callback ) => {
602663 const next = ( ) => callback ( ) ;
0 commit comments