Skip to content

Commit

Permalink
Use __mocks__ new_platform
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolf committed Jun 25, 2019
1 parent 4f5331c commit 2d666fa
Show file tree
Hide file tree
Showing 21 changed files with 27 additions and 50 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,11 @@ module.exports = {
'src/core/public/**/*',
'!src/core/public/index.ts',
'!src/core/public/mocks.ts',
'!src/core/public/*.test.mocks.ts',
'!src/core/public/utils/**/*',

'src/core/server/**/*',
'!src/core/server/index.ts',
'!src/core/server/mocks.ts',
'!src/core/server/*.test.mocks.ts',

'src/plugins/**/public/**/*',
'!src/plugins/**/public/index*',
Expand Down
30 changes: 0 additions & 30 deletions src/core/public/ui_new_platform.test.mocks.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/dev/jest/setup/mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
*/

jest.mock('ui/metadata');
jest.mock('ui/new_platform');
jest.mock('ui/documentation_links/documentation_links');
jest.mock('ui/chrome');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import '../ui_capabilities.test.mocks';
import '../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');

import { HelloWorldAction, SayHelloAction, EmptyEmbeddable } from '../test_samples/index';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import '../ui_capabilities.test.mocks';
import '../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');
import {
FilterableEmbeddable,
FilterableEmbeddableFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import '../ui_capabilities.test.mocks';
import '../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');

import * as Rx from 'rxjs';
import { skip } from 'rxjs/operators';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import '../ui_capabilities.test.mocks';
import '../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');
import {
ContactCardEmbeddable,
ContactCardEmbeddableInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/* eslint-disable max-classes-per-file */

import '../ui_capabilities.test.mocks';
import '../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');

import { skip } from 'rxjs/operators';
import { ContactCardEmbeddable, FilterableEmbeddable } from '../test_samples/index';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import './ui_capabilities.test.mocks';
jest.mock('ui/new_platform');

import {
HelloWorldAction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import '../ui_capabilities.test.mocks';
import '../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');

import React from 'react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import '../../../../ui_capabilities.test.mocks';
import '../../../../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');

import {
FilterableContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import '../../../../ui_capabilities.test.mocks';
import { coreStartMock } from '../../../../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');

import React from 'react';
import {
Expand All @@ -36,6 +36,8 @@ import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers';
import { skip } from 'rxjs/operators';
import * as Rx from 'rxjs';
import { EmbeddableFactory } from '../../../../embeddables';
import { OverlayStart } from 'src/core/public';
import { npStart } from 'ui/new_platform';

const onClose = jest.fn();
let container: Container;
Expand Down Expand Up @@ -79,7 +81,8 @@ test('create new calls factory.adds a panel to the container', async done => {

await nextTick();

const overlayMock = coreStartMock.overlays;
const overlayMock = npStart.core.overlays as jest.Mocked<PublicMethodsOf<OverlayStart>>;

((overlayMock.openModal.mock.calls[0][0] as any).props as ContactCardInitializerProps).onCreate({
firstName: 'Dany',
lastName: 'Targaryan',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import '../../../../ui_capabilities.test.mocks';
import '../../../../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');

import {
CONTACT_CARD_EMBEDDABLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import '../../../../ui_capabilities.test.mocks';
import '../../../../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');

import React from 'react';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import '../../../ui_capabilities.test.mocks';
import '../../../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');

import { EmbeddableInput } from '../../../embeddables/i_embeddable';
import { Embeddable } from '../../../embeddables/embeddable';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import '../../../ui_capabilities.test.mocks';
import '../../../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');

jest.mock('ui/inspector', () => ({
Inspector: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import '../../../ui_capabilities.test.mocks';
import '../../../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');

import {
FilterableContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import '../ui_capabilities.test.mocks';
import '../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');

import { EuiContextMenuPanelDescriptor } from '@elastic/eui';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import '../ui_capabilities.test.mocks';
import '../../../../../core/public/ui_new_platform.test.mocks';
jest.mock('ui/new_platform');

import { triggerRegistry } from '../triggers';
import { HELLO_WORLD_ACTION_ID } from '../test_samples';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
export { __setup__, __start__, npSetup, npStart } from './new_platform';

import { coreMock } from '../../../../core/public/mocks';

export const npStart = { core: coreMock.createStart() };
export const npSetup = { core: coreMock.createSetup() };
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { InternalCoreSetup, InternalCoreStart } from '../../../../core/public';
import { InternalCoreSetup, InternalCoreStart } from '../../../core/public';

export const npSetup = {
core: (null as unknown) as InternalCoreSetup,
Expand Down

0 comments on commit 2d666fa

Please sign in to comment.