Skip to content

Commit

Permalink
Fix existing jest tests and add test todos
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Roes committed Apr 20, 2020
1 parent c78f3f1 commit fbde5fb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
29 changes: 17 additions & 12 deletions src/plugins/data/public/search/tabify/buckets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import { TabifyBuckets } from './buckets';
import { AggGroupNames } from '../aggs';
import moment from 'moment';

describe('Buckets wrapper', () => {
const check = (aggResp: any, count: number, keys: string[]) => {
Expand Down Expand Up @@ -187,9 +188,9 @@ describe('Buckets wrapper', () => {
},
};
const timeRange = {
gte: 150,
lte: 350,
name: 'date',
from: moment(150),
to: moment(350),
timeFields: ['date'],
};
const buckets = new TabifyBuckets(aggResp, aggParams, timeRange);

Expand All @@ -204,9 +205,9 @@ describe('Buckets wrapper', () => {
},
};
const timeRange = {
gte: 150,
lte: 350,
name: 'date',
from: moment(150),
to: moment(350),
timeFields: ['date'],
};
const buckets = new TabifyBuckets(aggResp, aggParams, timeRange);

Expand All @@ -221,9 +222,9 @@ describe('Buckets wrapper', () => {
},
};
const timeRange = {
gte: 100,
lte: 400,
name: 'date',
from: moment(100),
to: moment(400),
timeFields: ['date'],
};
const buckets = new TabifyBuckets(aggResp, aggParams, timeRange);

Expand All @@ -238,13 +239,17 @@ describe('Buckets wrapper', () => {
},
};
const timeRange = {
gte: 150,
lte: 350,
name: 'date',
from: moment(150),
to: moment(350),
timeFields: ['date'],
};
const buckets = new TabifyBuckets(aggResp, aggParams, timeRange);

expect(buckets).toHaveLength(4);
});

test.todo('does drop bucket when multiple time fields specified');

test.todo('does drop all buckets with matchin time fields');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -262,20 +262,7 @@ describe('IndexPattern Data Source', () => {
Object {
"arguments": Object {
"aggConfigs": Array [
Object {
"chain": Array [
Object {
"arguments": Object {
"aggConfigs": Array [
"[{\\"id\\":\\"col1\\",\\"enabled\\":true,\\"type\\":\\"count\\",\\"schema\\":\\"metric\\",\\"params\\":{}},{\\"id\\":\\"col2\\",\\"enabled\\":true,\\"type\\":\\"date_histogram\\",\\"schema\\":\\"segment\\",\\"params\\":{\\"field\\":\\"timestamp\\",\\"useNormalizedEsInterval\\":true,\\"interval\\":\\"1d\\",\\"drop_partials\\":false,\\"min_doc_count\\":0,\\"extended_bounds\\":{}}}]",
],
},
"function": "lens_auto_date",
"type": "function",
},
],
"type": "expression",
},
"[{\\"id\\":\\"col1\\",\\"enabled\\":true,\\"type\\":\\"count\\",\\"schema\\":\\"metric\\",\\"params\\":{}},{\\"id\\":\\"col2\\",\\"enabled\\":true,\\"type\\":\\"date_histogram\\",\\"schema\\":\\"segment\\",\\"params\\":{\\"field\\":\\"timestamp\\",\\"useNormalizedEsInterval\\":true,\\"interval\\":\\"1d\\",\\"drop_partials\\":false,\\"min_doc_count\\":0,\\"extended_bounds\\":{}}}]",
],
"includeFormatHints": Array [
true,
Expand All @@ -289,6 +276,9 @@ describe('IndexPattern Data Source', () => {
"partialRows": Array [
false,
],
"timeField": Array [
"timestamp",
],
},
"function": "esaggs",
"type": "function",
Expand Down

0 comments on commit fbde5fb

Please sign in to comment.