Skip to content

Commit

Permalink
[Discover] Persist hide chart option to local storage
Browse files Browse the repository at this point in the history
  • Loading branch information
Maja Grubic committed Oct 11, 2021
1 parent 31302c0 commit 07f20ef
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,26 @@ import { uiSettingsMock } from '../../../../__mocks__/ui_settings';
import { indexPatternWithTimefieldMock } from '../../../../__mocks__/index_pattern_with_timefield';
import { savedSearchMock } from '../../../../__mocks__/saved_search';
import { indexPatternMock } from '../../../../__mocks__/index_pattern';
import { discoverServiceMock } from '../../../../__mocks__/services';

describe('getStateDefaults', () => {
const storage = discoverServiceMock.storage;

test('index pattern with timefield', () => {
savedSearchMock.searchSource = createSearchSourceMock({ index: indexPatternWithTimefieldMock });
const actual = getStateDefaults({
config: uiSettingsMock,
data: dataPluginMock.createStartContract(),
savedSearch: savedSearchMock,
storage,
});
expect(actual).toMatchInlineSnapshot(`
Object {
"columns": Array [
"default_column",
],
"filters": undefined,
"hideChart": undefined,
"hideChart": false,
"index": "index-pattern-with-timefield-id",
"interval": "auto",
"query": undefined,
Expand All @@ -49,14 +53,15 @@ describe('getStateDefaults', () => {
config: uiSettingsMock,
data: dataPluginMock.createStartContract(),
savedSearch: savedSearchMock,
storage,
});
expect(actual).toMatchInlineSnapshot(`
Object {
"columns": Array [
"default_column",
],
"filters": undefined,
"hideChart": undefined,
"hideChart": false,
"index": "the-index-pattern-id",
"interval": "auto",
"query": undefined,
Expand Down

0 comments on commit 07f20ef

Please sign in to comment.