Skip to content

Commit

Permalink
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
Browse files Browse the repository at this point in the history
…-fix'
  • Loading branch information
kibanamachine committed Feb 22, 2023
1 parent bb3a531 commit be61f88
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
7 changes: 4 additions & 3 deletions x-pack/plugins/lens/public/embeddable/embeddable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -502,10 +502,11 @@ export class Embeddable

// Update search context and reload on changes related to search
this.inputReloadSubscriptions.push(
shouldFetch$<LensEmbeddableInput>(this.getUpdated$(), () => this.getInput())
.subscribe((input) => {
shouldFetch$<LensEmbeddableInput>(this.getUpdated$(), () => this.getInput()).subscribe(
(input) => {
this.onContainerStateChanged(input);
})
}
)
);
}

Expand Down
45 changes: 21 additions & 24 deletions x-pack/plugins/maps/public/embeddable/map_embeddable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import { v4 as uuidv4 } from 'uuid';
import { map, distinctUntilChanged } from 'rxjs/operators';
import { MapEmbeddable } from './map_embeddable';

jest.mock('../kibana_services', () => {
Expand All @@ -26,8 +25,8 @@ jest.mock('../kibana_services', () => {
session: {
getSearchOptions() {
return undefined;
}
}
},
},
};
},
getShowMapsInspectorAdapter() {
Expand All @@ -37,9 +36,9 @@ jest.mock('../kibana_services', () => {
return {
getTime() {
return { from: 'now-7d', to: 'now' };
}
}
}
},
};
},
};
});

Expand All @@ -51,30 +50,28 @@ jest.mock('../connected_components/map_container', () => {
};
});

import { MapContainer } from '../connected_components/map_container';

jest.mock('../routes/map_page', () => {
class MockSavedMap {
// eslint-disable-next-line @typescript-eslint/no-var-requires
private _store = require('../reducers/store').createMapStore();
private _attributes = {
title: 'myMap'
title: 'myMap',
};

whenReady = async function() {}

getStore = function() {
whenReady = async function () {};

getStore = function () {
return this._store;
}
getAttributes = function() {
};
getAttributes = function () {
return this._attributes;
}
getAutoFitToBounds = function() {
};
getAutoFitToBounds = function () {
return true;
}
getSharingSavedObjectProps = function() {
};
getSharingSavedObjectProps = function () {
return null;
}
};
}
return { SavedMap: MockSavedMap };
});
Expand All @@ -83,7 +80,7 @@ function untilInitialized(mapEmbeddable: MapEmbeddable) {
return new Promise((resolve) => {
mapEmbeddable.setInitializationFinished = () => {
resolve();
}
};
});
}

Expand All @@ -105,7 +102,7 @@ describe('shouldFetch$', () => {
const fetchSpy = jest.spyOn(mapEmbeddable, '_dispatchSetQuery');

mapEmbeddable.updateInput({
title: 'updated map title'
title: 'updated map title',
});

await onNextTick();
Expand All @@ -127,7 +124,7 @@ describe('shouldFetch$', () => {
const fetchSpy = jest.spyOn(mapEmbeddable, '_dispatchSetQuery');

mapEmbeddable.updateInput({
searchSessionId: uuidv4()
searchSessionId: uuidv4(),
});

await onNextTick();
Expand All @@ -148,12 +145,12 @@ describe('shouldFetch$', () => {
const fetchSpy = jest.spyOn(mapEmbeddable, '_dispatchSetQuery');

mapEmbeddable.updateInput({
searchSessionId: uuidv4()
searchSessionId: uuidv4(),
});

await onNextTick();

expect(fetchSpy).not.toHaveBeenCalled();
});
});
});
});

0 comments on commit be61f88

Please sign in to comment.