@@ -356,6 +356,174 @@ describe("TIMESTAMP", function () {
356356 } ) ;
357357} ) ;
358358
359+ describe ( "TIMESTAMP_TZ" , function ( ) {
360+ it ( "should transform date as TIMESTAMP_TZ parameter" , async function ( ) {
361+ const preparedStatement = await conn . prepare (
362+ "MATCH (a:movies) WHERE a.description.release_tz > $1 RETURN COUNT(*)"
363+ ) ;
364+ const queryResult = await conn . execute ( preparedStatement , {
365+ 1 : new Date ( 0 ) ,
366+ } ) ;
367+ const result = await queryResult . getAll ( ) ;
368+ assert . equal ( result [ 0 ] [ "COUNT_STAR()" ] , 3 ) ;
369+ } ) ;
370+
371+ it ( "should reject other type as TIMESTAMP_TZ parameter" , async function ( ) {
372+ const preparedStatement = await conn . prepare (
373+ "MATCH (a:movies) WHERE a.description.release_tz > $1 RETURN COUNT(*)"
374+ ) ;
375+ try {
376+ await conn . execute ( preparedStatement , {
377+ 1 : "1970-01-01" ,
378+ } ) ;
379+ } catch ( e ) {
380+ assert . equal ( e . message , "Expected a date for parameter 1." ) ;
381+ }
382+
383+ try {
384+ await conn . execute ( preparedStatement , {
385+ 1 : 0 ,
386+ } ) ;
387+ } catch ( e ) {
388+ assert . equal ( e . message , "Expected a date for parameter 1." ) ;
389+ }
390+
391+ try {
392+ await conn . execute ( preparedStatement , {
393+ 1 : true ,
394+ } ) ;
395+ } catch ( e ) {
396+ assert . equal ( e . message , "Expected a date for parameter 1." ) ;
397+ }
398+ } ) ;
399+ } ) ;
400+
401+ describe ( "TIMESTAMP_NS" , function ( ) {
402+ it ( "should transform date as TIMESTAMP_NS parameter" , async function ( ) {
403+ const preparedStatement = await conn . prepare (
404+ "MATCH (a:movies) WHERE a.description.release_ns > $1 RETURN COUNT(*)"
405+ ) ;
406+ const queryResult = await conn . execute ( preparedStatement , {
407+ 1 : new Date ( 0 ) ,
408+ } ) ;
409+ const result = await queryResult . getAll ( ) ;
410+ assert . equal ( result [ 0 ] [ "COUNT_STAR()" ] , 3 ) ;
411+ } ) ;
412+
413+ it ( "should reject other type as TIMESTAMP_NS parameter" , async function ( ) {
414+ const preparedStatement = await conn . prepare (
415+ "MATCH (a:movies) WHERE a.description.release_ns > $1 RETURN COUNT(*)"
416+ ) ;
417+ try {
418+ await conn . execute ( preparedStatement , {
419+ 1 : "1970-01-01" ,
420+ } ) ;
421+ } catch ( e ) {
422+ assert . equal ( e . message , "Expected a date for parameter 1." ) ;
423+ }
424+
425+ try {
426+ await conn . execute ( preparedStatement , {
427+ 1 : 0 ,
428+ } ) ;
429+ } catch ( e ) {
430+ assert . equal ( e . message , "Expected a date for parameter 1." ) ;
431+ }
432+
433+ try {
434+ await conn . execute ( preparedStatement , {
435+ 1 : true ,
436+ } ) ;
437+ } catch ( e ) {
438+ assert . equal ( e . message , "Expected a date for parameter 1." ) ;
439+ }
440+ } ) ;
441+ } ) ;
442+
443+ describe ( "TIMESTAMP_MS" , function ( ) {
444+ it ( "should transform date as TIMESTAMP_MS parameter" , async function ( ) {
445+ const preparedStatement = await conn . prepare (
446+ "MATCH (a:movies) WHERE a.description.release_ms > $1 RETURN COUNT(*)"
447+ ) ;
448+ const queryResult = await conn . execute ( preparedStatement , {
449+ 1 : new Date ( 0 ) ,
450+ } ) ;
451+ const result = await queryResult . getAll ( ) ;
452+ assert . equal ( result [ 0 ] [ "COUNT_STAR()" ] , 3 ) ;
453+ } ) ;
454+
455+ it ( "should reject other type as TIMESTAMP_MS parameter" , async function ( ) {
456+ const preparedStatement = await conn . prepare (
457+ "MATCH (a:movies) WHERE a.description.release_ms > $1 RETURN COUNT(*)"
458+ ) ;
459+ try {
460+ await conn . execute ( preparedStatement , {
461+ 1 : "1970-01-01" ,
462+ } ) ;
463+ } catch ( e ) {
464+ assert . equal ( e . message , "Expected a date for parameter 1." ) ;
465+ }
466+
467+ try {
468+ await conn . execute ( preparedStatement , {
469+ 1 : 0 ,
470+ } ) ;
471+ } catch ( e ) {
472+ assert . equal ( e . message , "Expected a date for parameter 1." ) ;
473+ }
474+
475+ try {
476+ await conn . execute ( preparedStatement , {
477+ 1 : true ,
478+ } ) ;
479+ } catch ( e ) {
480+ assert . equal ( e . message , "Expected a date for parameter 1." ) ;
481+ }
482+ } ) ;
483+ } ) ;
484+
485+ describe ( "TIMESTAMP_SEC" , function ( ) {
486+ it ( "should transform date as TIMESTAMP_SEC parameter" , async function ( ) {
487+ const preparedStatement = await conn . prepare (
488+ "MATCH (a:movies) WHERE a.description.release_sec > $1 RETURN COUNT(*)"
489+ ) ;
490+ const queryResult = await conn . execute ( preparedStatement , {
491+ 1 : new Date ( 0 ) ,
492+ } ) ;
493+ const result = await queryResult . getAll ( ) ;
494+ assert . equal ( result [ 0 ] [ "COUNT_STAR()" ] , 3 ) ;
495+ } ) ;
496+
497+ it ( "should reject other type as TIMESTAMP_SEC parameter" , async function ( ) {
498+ const preparedStatement = await conn . prepare (
499+ "MATCH (a:movies) WHERE a.description.release_sec > $1 RETURN COUNT(*)"
500+ ) ;
501+ try {
502+ await conn . execute ( preparedStatement , {
503+ 1 : "1970-01-01" ,
504+ } ) ;
505+ } catch ( e ) {
506+ assert . equal ( e . message , "Expected a date for parameter 1." ) ;
507+ }
508+
509+ try {
510+ await conn . execute ( preparedStatement , {
511+ 1 : 0 ,
512+ } ) ;
513+ } catch ( e ) {
514+ assert . equal ( e . message , "Expected a date for parameter 1." ) ;
515+ }
516+
517+ try {
518+ await conn . execute ( preparedStatement , {
519+ 1 : true ,
520+ } ) ;
521+ } catch ( e ) {
522+ assert . equal ( e . message , "Expected a date for parameter 1." ) ;
523+ }
524+ } ) ;
525+ } ) ;
526+
359527describe ( "INTERVAL" , function ( ) {
360528 it ( "should transform number as INTERVAL parameter" , async function ( ) {
361529 const preparedStatement = await conn . prepare (
0 commit comments