@@ -324,6 +324,65 @@ describe('http driver', () => {
324
324
] , done ) ;
325
325
} ) ;
326
326
327
+ it ( 'should receive date' , done => {
328
+ testReceiveSingleValueWithHttpDriver (
329
+ 'RETURN date({year: 2019, month: 9, day: 28})' ,
330
+ '2019-09-28' ,
331
+ done ) ;
332
+ } ) ;
333
+
334
+ it ( 'should receive date-time with time zone id' , done => {
335
+ testReceiveSingleValueWithHttpDriver (
336
+ 'RETURN datetime({year: 1976, month: 11, day: 1, hour: 19, minute: 20, second: 55, nanosecond: 999111, timezone: "UTC"})' ,
337
+ '1976-11-01T19:20:55.000999111Z[UTC]' ,
338
+ done ) ;
339
+ } ) ;
340
+
341
+ it ( 'should receive date-time with time zone name' , done => {
342
+ testReceiveSingleValueWithHttpDriver (
343
+ 'RETURN datetime({year: 2012, month: 12, day: 12, hour: 1, minute: 9, second: 2, nanosecond: 123, timezone: "-08:30"})' ,
344
+ '2012-12-12T01:09:02.000000123-08:30' ,
345
+ done ) ;
346
+ } ) ;
347
+
348
+ it ( 'should receive duration' , done => {
349
+ testReceiveSingleValueWithHttpDriver (
350
+ 'RETURN duration({months: 3, days: 35, seconds: 19, nanoseconds: 937139})' ,
351
+ 'P3M35DT19.000937139S' ,
352
+ done ) ;
353
+ } ) ;
354
+
355
+ it ( 'should receive local date-time' , done => {
356
+ testReceiveSingleValueWithHttpDriver (
357
+ 'RETURN localdatetime({year: 2032, month: 5, day: 17, hour: 13, minute: 56, second: 51, nanosecond: 999888111})' ,
358
+ '2032-05-17T13:56:51.999888111' ,
359
+ done ) ;
360
+ } ) ;
361
+
362
+ it ( 'should receive local time' , done => {
363
+ testReceiveSingleValueWithHttpDriver (
364
+ 'RETURN localtime({hour: 17, minute: 2, second: 21, nanosecond: 123456789})' ,
365
+ '17:02:21.123456789' ,
366
+ done ) ;
367
+ } ) ;
368
+
369
+ it ( 'should receive time' , done => {
370
+ testReceiveSingleValueWithHttpDriver (
371
+ 'RETURN time({hour: 21, minute: 19, second: 1, nanosecond: 111, timezone: "+03:15"})' ,
372
+ '21:19:01.000000111+03:15' ,
373
+ done ) ;
374
+ } ) ;
375
+
376
+ function testReceiveSingleValueWithHttpDriver ( query , expectedValue , done ) {
377
+ runQueryAndGetResults ( query , { } , httpDriver ) . then ( results => {
378
+ const receivedValue = results [ 0 ] [ 0 ] ;
379
+ expect ( expectedValue ) . toEqual ( receivedValue ) ;
380
+ done ( ) ;
381
+ } ) . catch ( error => {
382
+ done . fail ( error ) ;
383
+ } ) ;
384
+ }
385
+
327
386
function testSendAndReceiveWithReturnQuery ( values , done ) {
328
387
const query = 'RETURN $value' ;
329
388
0 commit comments