Skip to content

Commit

Permalink
✅ Fix jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 committed Oct 17, 2022
1 parent 862931b commit 5eb26e0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,12 @@ describe('IndexPattern Data Source', () => {
"partialRows": Array [
false,
],
"probability": Array [
1,
],
"samplerSeed": Array [
453225886,
],
"timeFields": Array [
"timestamp",
],
Expand Down Expand Up @@ -1631,6 +1637,7 @@ describe('IndexPattern Data Source', () => {
},
},
currentIndexPatternId: '1',
sampling: 1,
};
expect(FormBasedDatasource.insertLayer(state, 'newLayer')).toEqual({
...state,
Expand All @@ -1640,6 +1647,7 @@ describe('IndexPattern Data Source', () => {
indexPatternId: '1',
columnOrder: [],
columns: {},
sampling: 1,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function testInitialState(): FormBasedPrivateState {
currentIndexPatternId: '1',
layers: {
first: {
sampling: 1,
indexPatternId: '1',
columnOrder: ['col1'],
columns: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,9 @@ function getEmptyLayerSuggestionsForField(
}

// copy the sampling rate to the new layer
// or just default to 1
if (newLayer) {
newLayer.sampling = state.layers[layerId].sampling;
newLayer.sampling = state.layers[layerId]?.sampling ?? 1;
}

const newLayerSuggestions = newLayer
Expand Down

0 comments on commit 5eb26e0

Please sign in to comment.