* Fix broken Lens tests * Fix lens Jest tests
This commit is contained in:
parent
760ac6ae42
commit
612aaf4bf3
|
@ -170,8 +170,7 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
};
|
||||
});
|
||||
|
||||
// FAILING, fix coming ASAP
|
||||
describe.skip('#getDatasourceSuggestionsForField', () => {
|
||||
describe('#getDatasourceSuggestionsForField', () => {
|
||||
describe('with no layer', () => {
|
||||
let initialState: IndexPatternPrivateState;
|
||||
|
||||
|
@ -191,39 +190,40 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
field: { name: 'source', type: 'string', aggregatable: true, searchable: true },
|
||||
indexPatternId: '1',
|
||||
});
|
||||
expect(suggestions).toHaveLength(1);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
suggestedLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'terms',
|
||||
sourceField: 'source',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'count',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
suggestedLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'terms',
|
||||
sourceField: 'source',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'count',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
table: {
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'suggestedLayer',
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(suggestions[0].table).toEqual({
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'suggestedLayer',
|
||||
});
|
||||
});
|
||||
|
||||
it('should apply a bucketed aggregation for a date field', () => {
|
||||
|
@ -232,39 +232,40 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
indexPatternId: '1',
|
||||
});
|
||||
|
||||
expect(suggestions).toHaveLength(1);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
suggestedLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'count',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
suggestedLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'count',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
table: {
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'suggestedLayer',
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(suggestions[0].table).toEqual({
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'suggestedLayer',
|
||||
});
|
||||
});
|
||||
|
||||
it('should select a metric for a number field', () => {
|
||||
|
@ -273,40 +274,41 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
indexPatternId: '1',
|
||||
});
|
||||
|
||||
expect(suggestions.length).toBeGreaterThan(0);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
suggestedLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'avg',
|
||||
sourceField: 'bytes',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
suggestedLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'avg',
|
||||
sourceField: 'bytes',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
table: {
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'suggestedLayer',
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(suggestions[0].table).toEqual({
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'suggestedLayer',
|
||||
});
|
||||
});
|
||||
|
||||
it('should make a metric suggestion for a number field if there is no time field', async () => {
|
||||
|
@ -341,20 +343,21 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
indexPatternId: '1',
|
||||
});
|
||||
|
||||
expect(suggestions.length).toEqual(1);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
first: expect.objectContaining({
|
||||
columnOrder: ['suggestedLayer'],
|
||||
columns: {
|
||||
suggestedLayer: expect.objectContaining({
|
||||
operationType: 'avg',
|
||||
sourceField: 'bytes',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
first: expect.objectContaining({
|
||||
columnOrder: ['suggestedLayer'],
|
||||
columns: {
|
||||
suggestedLayer: expect.objectContaining({
|
||||
operationType: 'avg',
|
||||
sourceField: 'bytes',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
@ -385,39 +388,40 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
indexPatternId: '1',
|
||||
});
|
||||
|
||||
expect(suggestions).toHaveLength(1);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'terms',
|
||||
sourceField: 'source',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'count',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'terms',
|
||||
sourceField: 'source',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'count',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
table: {
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'previousLayer',
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(suggestions[0].table).toEqual({
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'previousLayer',
|
||||
});
|
||||
});
|
||||
|
||||
it('should apply a bucketed aggregation for a date field', () => {
|
||||
|
@ -426,39 +430,40 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
indexPatternId: '1',
|
||||
});
|
||||
|
||||
expect(suggestions).toHaveLength(1);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'count',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'count',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
table: {
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'previousLayer',
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(suggestions[0].table).toEqual({
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'previousLayer',
|
||||
});
|
||||
});
|
||||
|
||||
it('should select a metric for a number field', () => {
|
||||
|
@ -467,40 +472,41 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
indexPatternId: '1',
|
||||
});
|
||||
|
||||
expect(suggestions.length).toBeGreaterThan(0);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'avg',
|
||||
sourceField: 'bytes',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'avg',
|
||||
sourceField: 'bytes',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
table: {
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'previousLayer',
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(suggestions[0].table).toEqual({
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'previousLayer',
|
||||
});
|
||||
});
|
||||
|
||||
it('should make a metric suggestion for a number field if there is no time field', async () => {
|
||||
|
@ -535,20 +541,21 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
indexPatternId: '1',
|
||||
});
|
||||
|
||||
expect(suggestions).toHaveLength(1);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: expect.objectContaining({
|
||||
columnOrder: ['col1'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'avg',
|
||||
sourceField: 'bytes',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: expect.objectContaining({
|
||||
columnOrder: ['col1'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'avg',
|
||||
sourceField: 'bytes',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
@ -633,22 +640,23 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
}
|
||||
);
|
||||
|
||||
expect(suggestions).toHaveLength(1);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: initialState.layers.previousLayer,
|
||||
currentLayer: expect.objectContaining({
|
||||
columnOrder: ['newId', 'col2'],
|
||||
columns: {
|
||||
newId: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'start_date',
|
||||
}),
|
||||
col2: initialState.layers.currentLayer.columns.col2,
|
||||
},
|
||||
}),
|
||||
},
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: initialState.layers.previousLayer,
|
||||
currentLayer: expect.objectContaining({
|
||||
columnOrder: ['newId', 'col2'],
|
||||
columns: {
|
||||
newId: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'start_date',
|
||||
}),
|
||||
col2: initialState.layers.currentLayer.columns.col2,
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
@ -659,41 +667,42 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
indexPatternId: '1',
|
||||
});
|
||||
|
||||
expect(suggestions).toHaveLength(1);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: initialState.layers.previousLayer,
|
||||
currentLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'newId', 'col2'],
|
||||
columns: {
|
||||
...initialState.layers.currentLayer.columns,
|
||||
newId: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: initialState.layers.previousLayer,
|
||||
currentLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'newId', 'col2'],
|
||||
columns: {
|
||||
...initialState.layers.currentLayer.columns,
|
||||
newId: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
table: {
|
||||
changeType: 'extended',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'newId',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'currentLayer',
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(suggestions[0].table).toEqual({
|
||||
changeType: 'extended',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'newId',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'currentLayer',
|
||||
});
|
||||
});
|
||||
|
||||
it('does not use the same field for bucketing multiple times', () => {
|
||||
|
@ -711,22 +720,23 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
indexPatternId: '1',
|
||||
});
|
||||
|
||||
expect(suggestions).toHaveLength(1);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: initialState.layers.previousLayer,
|
||||
currentLayer: expect.objectContaining({
|
||||
columnOrder: ['newId', 'col1', 'col2'],
|
||||
columns: {
|
||||
...initialState.layers.currentLayer.columns,
|
||||
newId: expect.objectContaining({
|
||||
operationType: 'terms',
|
||||
sourceField: 'dest',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: initialState.layers.previousLayer,
|
||||
currentLayer: expect.objectContaining({
|
||||
columnOrder: ['newId', 'col1', 'col2'],
|
||||
columns: {
|
||||
...initialState.layers.currentLayer.columns,
|
||||
newId: expect.objectContaining({
|
||||
operationType: 'terms',
|
||||
sourceField: 'dest',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
@ -737,22 +747,23 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
indexPatternId: '1',
|
||||
});
|
||||
|
||||
expect(suggestions).toHaveLength(1);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: initialState.layers.previousLayer,
|
||||
currentLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2', 'newId'],
|
||||
columns: {
|
||||
...initialState.layers.currentLayer.columns,
|
||||
newId: expect.objectContaining({
|
||||
operationType: 'avg',
|
||||
sourceField: 'memory',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: initialState.layers.previousLayer,
|
||||
currentLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2', 'newId'],
|
||||
columns: {
|
||||
...initialState.layers.currentLayer.columns,
|
||||
newId: expect.objectContaining({
|
||||
operationType: 'avg',
|
||||
sourceField: 'memory',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
@ -763,22 +774,23 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
indexPatternId: '1',
|
||||
});
|
||||
|
||||
expect(suggestions).toHaveLength(1);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: initialState.layers.previousLayer,
|
||||
currentLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2', 'newId'],
|
||||
columns: {
|
||||
...initialState.layers.currentLayer.columns,
|
||||
newId: expect.objectContaining({
|
||||
operationType: 'sum',
|
||||
sourceField: 'bytes',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: initialState.layers.previousLayer,
|
||||
currentLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2', 'newId'],
|
||||
columns: {
|
||||
...initialState.layers.currentLayer.columns,
|
||||
newId: expect.objectContaining({
|
||||
operationType: 'sum',
|
||||
sourceField: 'bytes',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
@ -827,40 +839,41 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
indexPatternId: '2',
|
||||
});
|
||||
|
||||
expect(suggestions).toHaveLength(1);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: initialState.layers.previousLayer,
|
||||
currentLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'count',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
previousLayer: initialState.layers.previousLayer,
|
||||
currentLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'count',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
table: {
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'currentLayer',
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(suggestions[0].table).toEqual({
|
||||
changeType: 'initial',
|
||||
label: undefined,
|
||||
isMultiRow: true,
|
||||
columns: [
|
||||
expect.objectContaining({
|
||||
columnId: 'col1',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
columnId: 'col2',
|
||||
}),
|
||||
],
|
||||
layerId: 'currentLayer',
|
||||
});
|
||||
});
|
||||
|
||||
it('suggests on the layer with the fewest columns that matches by indexPatternId', () => {
|
||||
|
@ -881,24 +894,25 @@ describe('IndexPattern Data Source suggestions', () => {
|
|||
}
|
||||
);
|
||||
|
||||
expect(suggestions).toHaveLength(1);
|
||||
expect(suggestions[0].state).toEqual(
|
||||
expect(suggestions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
layers: {
|
||||
currentLayer: initialState.layers.currentLayer,
|
||||
previousLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'count',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
state: expect.objectContaining({
|
||||
layers: {
|
||||
currentLayer: initialState.layers.currentLayer,
|
||||
previousLayer: expect.objectContaining({
|
||||
columnOrder: ['col1', 'col2'],
|
||||
columns: {
|
||||
col1: expect.objectContaining({
|
||||
operationType: 'date_histogram',
|
||||
sourceField: 'timestamp',
|
||||
}),
|
||||
col2: expect.objectContaining({
|
||||
operationType: 'count',
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue