Make tests pass

table/group-by
ebb-tide 2018-04-20 16:08:13 -07:00
parent 2b07507f1a
commit 5ca7265447
1 changed files with 68 additions and 3 deletions

View File

@ -341,13 +341,45 @@ describe('timeSeriesToTableGraph', () => {
},
]
const actual = timeSeriesToTableGraph(influxResponse)
const qASTs = [
{
groupBy: {
time: {
interval: '2s',
},
},
},
{
groupBy: {
time: {
interval: '2s',
},
},
},
{
groupBy: {
time: {
interval: '2s',
},
},
},
{
groupBy: {
time: {
interval: '2s',
},
},
},
]
const actual = timeSeriesToTableGraph(influxResponse, qASTs)
const expected = [
['time', 'ma.f1', 'mb.f1', 'mc.f1', 'mc.f2'],
[1000, 1, 1, null, null],
[2000, 2, 2, 3, 3],
[4000, null, null, 4, 4],
]
expect(actual.data).toEqual(expected)
})
@ -397,7 +429,38 @@ describe('timeSeriesToTableGraph', () => {
},
]
const actual = timeSeriesToTableGraph(influxResponse)
const qASTs = [
{
groupBy: {
time: {
interval: '2s',
},
},
},
{
groupBy: {
time: {
interval: '2s',
},
},
},
{
groupBy: {
time: {
interval: '2s',
},
},
},
{
groupBy: {
time: {
interval: '2s',
},
},
},
]
const actual = timeSeriesToTableGraph(influxResponse, qASTs)
const expected = ['time', 'ma.f1', 'mb.f1', 'mc.f1', 'mc.f2']
expect(actual.data[0]).toEqual(expected)
@ -406,7 +469,9 @@ describe('timeSeriesToTableGraph', () => {
it('returns an array of an empty array if there is an empty response', () => {
const influxResponse = []
const actual = timeSeriesToTableGraph(influxResponse)
const qASTs = []
const actual = timeSeriesToTableGraph(influxResponse, qASTs)
const expected = [[]]
expect(actual.data).toEqual(expected)