diff --git a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js index 3d4292cef27f4..fbb7b45a8a029 100644 --- a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js +++ b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js @@ -131,6 +131,9 @@ export const npSetup = { featureCatalogue: { register: sinon.fake(), }, + environment: { + update: sinon.fake(), + }, }, }, }; diff --git a/src/plugins/home/public/services/environment/environment.test.ts b/src/plugins/home/public/services/environment/environment.test.ts index 205fd1c3a37f5..476c22658dd04 100644 --- a/src/plugins/home/public/services/environment/environment.test.ts +++ b/src/plugins/home/public/services/environment/environment.test.ts @@ -41,14 +41,5 @@ describe('EnvironmentService', () => { setup.update({ ml: false, apmUi: true }); expect(service.start().get()).toEqual({ ml: false, cloud: true, apmUi: true }); }); - - test('fails if trying to update state after setup phase', () => { - const service = new EnvironmentService(); - const setup = service.setup(); - service.start(); - expect(() => { - setup.update({ ml: true }); - }).toThrow(); - }); }); }); diff --git a/src/plugins/home/public/services/environment/environment.ts b/src/plugins/home/public/services/environment/environment.ts index 41699daa98b3c..36c1afbca5e73 100644 --- a/src/plugins/home/public/services/environment/environment.ts +++ b/src/plugins/home/public/services/environment/environment.ts @@ -34,7 +34,6 @@ export interface Environment { } export class EnvironmentService { - private frozen = false; private environment = { cloud: false, apmUi: false, @@ -51,19 +50,12 @@ export class EnvironmentService { * @param update */ update: (update: Partial) => { - if (this.frozen) { - throw new Error( - 'Environment already frozen, did you try to change the environment in the start phase?' - ); - } this.environment = Object.assign({}, this.environment, update); }, }; } public start() { - this.frozen = true; - Object.freeze(this.environment); return { /** * Retrieve the current environment home is running in. This API is only intended for internal