Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Heenawter committed Apr 21, 2022
1 parent fe46be5 commit c7f4570
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions src/plugins/dashboard/server/usage/dashboard_telemetry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

import { SavedDashboardPanel730ToLatest } from '../../common';
import { getEmptyDashboardData, collectPanelsByType } from './dashboard_telemetry';
import { EmbeddableStateWithType } from '@kbn/embeddable-plugin/common';
import { createEmbeddablePersistableStateServiceMock } from '@kbn/embeddable-plugin/common/mocks';
import { EmbeddableStateWithType } from '../../../embeddable/common';
import { createEmbeddablePersistableStateServiceMock } from '../../../embeddable/common/mocks';
import { SavedObjectReference } from 'kibana/public';

const visualizationType1ByValue = {
embeddableConfig: {
Expand Down Expand Up @@ -96,21 +97,25 @@ const embeddablePersistableStateService = createEmbeddablePersistableStateServic

describe('dashboard telemetry', () => {
beforeAll(() => {
embeddablePersistableStateService.extract.mockImplementationOnce((state) => {
const { HARDCODED_ID, ...restOfState } = state as unknown as Record<string, unknown>;
return {
state: restOfState as EmbeddableStateWithType,
references: [{ id: HARDCODED_ID as string, name: 'refName', type: 'type' }],
};
});

embeddablePersistableStateService.inject.mockImplementationOnce((state, references) => {
const ref = references.find((r) => r.name === 'refName');
return {
...state,
HARDCODED_ID: ref!.id,
};
});
embeddablePersistableStateService.extract.mockImplementationOnce(
(state: EmbeddableStateWithType) => {
const { HARDCODED_ID, ...restOfState } = state as unknown as Record<string, unknown>;
return {
state: restOfState as EmbeddableStateWithType,
references: [{ id: HARDCODED_ID as string, name: 'refName', type: 'type' }],
};
}
);

embeddablePersistableStateService.inject.mockImplementationOnce(
(state: EmbeddableStateWithType, references: SavedObjectReference[]) => {
const ref = references.find((r: SavedObjectReference) => r.name === 'refName');
return {
...state,
HARDCODED_ID: ref!.id,
};
}
);
});

it('collects information about dashboard panels', () => {
Expand Down

0 comments on commit c7f4570

Please sign in to comment.