From 6bf90e69bb0beeb26e01a9a003b6b231aa2cfec9 Mon Sep 17 00:00:00 2001 From: rozetko Date: Wed, 28 Dec 2022 18:29:50 +0300 Subject: [PATCH] upd SQL test --- spec/sql.jest.ts | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/spec/sql.jest.ts b/spec/sql.jest.ts index ad828de..6c27003 100644 --- a/spec/sql.jest.ts +++ b/spec/sql.jest.ts @@ -37,22 +37,40 @@ describe('Test result parsing', function() { data: { results: { A: { - refId: 'A', - meta: { - rowCount:0, - sql: 'SELECT "time" AS "time", val FROM local ORDER BY 1' - }, - series: [ + frames: [ { - name:"val", - points: [ - [622, timestamps[0]], - [844, timestamps[1]], - [648, timestamps[2]] - ] + schema: { + refId: 'A', + meta: { + 'executedQueryString': 'SELECT\n \"time\" AS \"time\",\n eur\nFROM rate_test\nWHERE\n \"time\" >= 1669648679 AND \"time\" <= 1672240679\nORDER BY 1' + }, + fields: [ + { + name: 'Time', + type: 'time', + typeInfo: { + frame: 'time.Time', + nullable: true + } + }, + { + name: 'eur', + type: 'number', + typeInfo: { + frame: 'float64', + nullable: true + } + } + ] + }, + data: { + values: [ + [ timestamps[0], timestamps[1], timestamps[2] ], + [ 1.53, 1.17, 1.17 ], + ] + } } - ], - tables: 'null' + ] } } } @@ -61,7 +79,7 @@ describe('Test result parsing', function() { let result = connector.parseResponse(response); it('check results columns order', function() { - let timestampColumnNumber = result.columns.indexOf('timestamp'); + let timestampColumnNumber = result.columns.indexOf('Time'); expect(result.values.map(v => v[timestampColumnNumber])).toEqual(timestamps); }); });