mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Reorganize stuff to prevent circular dependencies Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Install injectable extension to allow injecting reactively many implementations Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Switch to using computedInjectMany over filtering injectMany based on enabled extensions for simplicity Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove await for not being needed Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Sort dependencies alphabetically Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
import { LensMainExtension } from "../../extensions/lens-main-extension";
|
|
import type { TrayMenuRegistration } from "../../main/tray/tray-menu-registration";
|
|
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
|
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
|
import getRandomIdInjectable from "../../common/utils/get-random-id.injectable";
|
|
|
|
describe("multiple separators originating from extension", () => {
|
|
let applicationBuilder: ApplicationBuilder;
|
|
|
|
beforeEach(async () => {
|
|
applicationBuilder = getApplicationBuilder();
|
|
|
|
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
|
mainDi.unoverride(getRandomIdInjectable);
|
|
mainDi.permitSideEffects(getRandomIdInjectable);
|
|
});
|
|
|
|
await applicationBuilder.render();
|
|
});
|
|
|
|
it("given extension with multiple separators, when extension is enabled, does not throw", () => {
|
|
const someExtension = new SomeTestExtension({
|
|
id: "some-extension-id",
|
|
trayMenus: [{ type: "separator" }, { type: "separator" } ],
|
|
});
|
|
|
|
expect(() => {
|
|
applicationBuilder.extensions.main.enable(someExtension);
|
|
}).not.toThrow();
|
|
});
|
|
});
|
|
|
|
class SomeTestExtension extends LensMainExtension {
|
|
constructor({ id, trayMenus }: {
|
|
id: string;
|
|
trayMenus: TrayMenuRegistration[];
|
|
}) {
|
|
super({
|
|
id,
|
|
absolutePath: "irrelevant",
|
|
isBundled: false,
|
|
isCompatible: false,
|
|
isEnabled: false,
|
|
manifest: { name: id, version: "some-version", engines: { lens: "^5.5.0" }},
|
|
manifestPath: "irrelevant",
|
|
});
|
|
|
|
this.trayMenus = trayMenus;
|
|
}
|
|
}
|