Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core/ui] bootstrap the legacy platform within the new platform #20699

Merged
merged 37 commits into from
Jul 18, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
97c86a3
[core/ui] bootstrap the legacy platform within the new platform
Jul 11, 2018
a7fd8fb
fix test that parsed uiApp response
Jul 11, 2018
bb73252
fix missed rename
Jul 11, 2018
0a8dcec
use a legacy platform service to bootstrap within the start() lifecycle
Jul 12, 2018
f1a698e
[tests/ui_exports_replace_injected_vars] read vars from legacyMetadata
Jul 12, 2018
9984fa5
[core/injectedMetadata] use less permissive array type to avoid freez…
Jul 12, 2018
6624b58
[ui/metadata/tests] remove unnecessary test
Jul 12, 2018
e514979
Merge branch 'master' of github.com:elastic/kibana into implement/new…
Jul 12, 2018
4f8fe21
implement feedback from Court
Jul 12, 2018
5357110
restore app_entry_template tests
Jul 12, 2018
3c71d11
Merge branch 'master' of github.com:elastic/kibana into implement/new…
Jul 13, 2018
b662c4d
[ui/notify/tests] remove reference to window.__KBN__
Jul 13, 2018
277f273
Merge branch 'master' of github.com:elastic/kibana into implement/new…
Jul 13, 2018
e404fa4
[core] use *StartContract naming convention
Jul 13, 2018
cc1d8f0
Merge branch 'master' of github.com:elastic/kibana into implement/new…
Jul 13, 2018
2151adf
[tslint] ignore fixtures in precommit hook
Jul 13, 2018
04af61a
[core/public] add tests, use *Params in constructors
Jul 13, 2018
9c76bfb
[core/public/tests] fix type definitions
Jul 13, 2018
3073159
[core/public/legacyPlatform] test arguments to legacy bootstrap module
Jul 13, 2018
450e6b1
[core/public/core/tests] use correct services for mock generics
Jul 13, 2018
5a5210b
Merge branch 'master' of github.com:elastic/kibana into implement/new…
Jul 13, 2018
675f032
[core/public] list explicit params for core service
Jul 13, 2018
7ec434b
Merge branch 'master' of github.com:elastic/kibana into implement/new…
Jul 16, 2018
33a74af
[core/public] tweak tests to address feedback
Jul 16, 2018
3e5a2ab
[core/public/core/tests] start the core once in each tests so mocks c…
Jul 16, 2018
e6c5c0b
Merge branch 'master' of github.com:elastic/kibana into implement/new…
Jul 18, 2018
0ec8793
[testBundle] use a Set() to avoid duplication
Jul 18, 2018
794ae2c
[core/public] add comments describing the core services/systems
Jul 18, 2018
fad92a0
[core/public] use `readonly` modifier for params property
Jul 18, 2018
7442290
[uiBundles] add comment about isCacheValid()
Jul 18, 2018
4567aed
[eslintResolver] remove ui_framework alias from webpack config
Jul 18, 2018
4f9f64d
fix references to remove kbn-initial-state element
Jul 18, 2018
874029c
[core/public/tests] use destructuring for readability
Jul 18, 2018
c210fef
[core/public/tests] cleanup in after hook for clarity
Jul 18, 2018
7a4987f
[core/public/deepFreeze] test that freezing arrays is supported
Jul 18, 2018
5b0edf1
[testsBundle] fix typo
Jul 18, 2018
9710387
[core/public/tests] fix typo
Jul 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/core/public/core_system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,22 @@ describe('constructor', () => {
});

describe('#start()', () => {
it('calls lifecycleSystem#start() and injectedMetadata#start()', () => {
const core = new CoreSystem({
let core;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought you were the one in particular that hated this pattern and wanted everyone to use setup functions instead!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, I do, but setup functions are best because they take arguments, when there aren't any arguments I'm not super picky. But point taken!

Copy link
Contributor Author

@spalger spalger Jul 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also the issue that the mocks are cleared between each test, so starting core once and reusing the value for each test wouldn't work anyway.


beforeAll(() => {
core = new CoreSystem({
...defaultCoreSystemParams,
});

expect(core.start()).toBe(undefined);
core.start();
});

it('calls injectedMetadata#start()', () => {
expect(MockInjectedMetadataService.mock.instances[0].start).toHaveBeenCalledTimes(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional nit: maybe destructuring can make it a little bit more readable: const [mockInstance] = MockInjectedMetadataService.mock.instances;

expect(MockInjectedMetadataService.mock.instances[0].start).toHaveBeenCalledWith();
});

it('calls lifecycleSystem#start()', () => {
expect(MockLegacyPlatformService.mock.instances[0].start).toHaveBeenCalledTimes(1);
expect(MockLegacyPlatformService.mock.instances[0].start).toHaveBeenCalledWith({
injectedMetadata: mockInjectedMetadataStartContract,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@
import { InjectedMetadataService } from './injected_metadata_service';

describe('#start()', () => {
it('returns the start contract', () => {
const injectedMetadata = new InjectedMetadataService({
injectedMetadata: {} as any,
});

const contract = injectedMetadata.start();
expect(contract).toEqual({
getLegacyMetadata: expect.any(Function),
});
});

it('deeply freezes its injectedMetadata param', () => {
const params = {
injectedMetadata: { foo: true } as any,
Expand Down
11 changes: 0 additions & 11 deletions src/core/public/legacy_platform/legacy_platform_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,6 @@ beforeEach(() => {

describe('#start()', () => {
describe('default', () => {
it('does not return a start contract', () => {
const legacyPlatform = new LegacyPlatformService({
...defaultParams,
});

const startContract = legacyPlatform.start({
injectedMetadata: injectedMetadataStartContract,
});
expect(startContract).toBe(undefined);
});

it('passes legacy metadata from injectedVars to ui/metadata', () => {
const legacyMetadata = { isLegacyMetadata: true };
injectedMetadataStartContract.getLegacyMetadata.mockReturnValue(legacyMetadata);
Expand Down