1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

chore: Fix lint errors after rebase

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-05-26 15:33:04 -04:00
parent 4d416162ed
commit 4c69af5642
3 changed files with 24 additions and 15 deletions

View File

@ -23,9 +23,10 @@ describe("Viewing Custom Resources with extra columns", () => {
beforeEach(async () => { beforeEach(async () => {
builder = getApplicationBuilder(); builder = getApplicationBuilder();
builder.setEnvironmentToClusterFrame();
builder.afterWindowStart(({ windowDi }) => { await builder.setEnvironmentToClusterFrame();
await builder.afterWindowStart(({ windowDi }) => {
const apiManager = windowDi.inject(apiManagerInjectable); const apiManager = windowDi.inject(apiManagerInjectable);
customResourceDefinitionStore = windowDi.inject(customResourceDefinitionStoreInjectable); customResourceDefinitionStore = windowDi.inject(customResourceDefinitionStoreInjectable);

View File

@ -47,7 +47,7 @@ describe("hotbar-welcome-page-migration", () => {
let migration: MigrationDeclaration; let migration: MigrationDeclaration;
let store: MigrationStore; let store: MigrationStore;
const storeModel = new Map(); const storeModel = new Map<string, unknown>();
beforeEach(() => { beforeEach(() => {
migration = di.inject(v640HotbarStoreMigrationInjectable); migration = di.inject(v640HotbarStoreMigrationInjectable);
@ -63,25 +63,29 @@ describe("hotbar-welcome-page-migration", () => {
storeModel.set("hotbars", [emptyHotbar]); storeModel.set("hotbars", [emptyHotbar]);
store = { store = {
path: "some-path", path: "some-path",
get: (key: string) => storeModel.get(key), get: (key) => storeModel.get(key),
set: (key: string, value: any) => storeModel.set(key, value), set: (key, value) => storeModel.set(key, value),
delete: (key: string) => storeModel.delete(key), delete: (key) => storeModel.delete(key),
has: (key: string) => storeModel.has(key), has: (key) => storeModel.has(key),
clear: () => storeModel.clear(), clear: () => storeModel.clear(),
}; } as MigrationStore;
}); });
it("given first hotbar is empty, adds welcome page to first place", () => { it("given first hotbar is empty, adds welcome page to first place", () => {
migration.run(store); migration.run(store);
expect(storeModel.get("hotbars")[0].items[0]).toEqual(welcomeHotbarItem);
const hotbars = storeModel.get("hotbars") as HotbarData[];
expect(hotbars[0]?.items[0]).toEqual(welcomeHotbarItem);
}); });
it("given first hotbar has items but is not full, adds welcome page to first place", () => { it("given first hotbar has items but is not full, adds welcome page to first place", () => {
setFirstHotbarItems(store, [someItem]); setFirstHotbarItems(store, [someItem]);
migration.run(store); migration.run(store);
const hotbars = storeModel.get("hotbars") as HotbarData[];
expect(storeModel.get("hotbars")[0].items.slice(0, 2)).toEqual([welcomeHotbarItem, someItem]); expect(hotbars[0]?.items.slice(0, 2)).toEqual([welcomeHotbarItem, someItem]);
}); });
it("given first hotbar is full, does not add welcome page", () => { it("given first hotbar is full, does not add welcome page", () => {
@ -90,9 +94,10 @@ describe("hotbar-welcome-page-migration", () => {
setFirstHotbarItems(store, fullHotbarItems); setFirstHotbarItems(store, fullHotbarItems);
migration.run(store); migration.run(store);
const hotbars = storeModel.get("hotbars") as HotbarData[];
expect(storeModel.get("hotbars")[0].items).toEqual(fullHotbarItems); expect(hotbars[0]?.items).toEqual(fullHotbarItems);
expect(storeModel.get("hotbars")[0].items).not.toContain(welcomeHotbarItem); expect(hotbars[0]?.items).not.toContain(welcomeHotbarItem);
}); });
it("given first hotbar has already welcome page, does not add welcome page", () => { it("given first hotbar has already welcome page, does not add welcome page", () => {
@ -100,6 +105,9 @@ describe("hotbar-welcome-page-migration", () => {
setFirstHotbarItems(store, hotBarItemsWithWelcomePage); setFirstHotbarItems(store, hotBarItemsWithWelcomePage);
migration.run(store); migration.run(store);
expect(storeModel.get("hotbars")[0].items).toEqual(hotBarItemsWithWelcomePage);
const hotbars = storeModel.get("hotbars") as HotbarData[];
expect(hotbars[0]?.items).toEqual(hotBarItemsWithWelcomePage);
}); });
}); });

View File

@ -83,13 +83,13 @@ const NonInjectedHotbarSelector = observer(({
className={styles.Badge} className={styles.Badge}
onMouseEnter={onMouseEvent} onMouseEnter={onMouseEvent}
onMouseLeave={onMouseEvent} onMouseLeave={onMouseEvent}
data-testid={`hotbar-menu-badge-for-${hotbar?.name.get()}`} data-testid={hotbar ? `hotbar-menu-badge-for-${hotbar.name.get()}` : undefined}
/> />
<Tooltip <Tooltip
visible={tooltipVisible} visible={tooltipVisible}
targetId="hotbarIndex" targetId="hotbarIndex"
preferredPositions={[TooltipPosition.TOP, TooltipPosition.TOP_LEFT]} preferredPositions={[TooltipPosition.TOP, TooltipPosition.TOP_LEFT]}
data-testid={`hotbar-menu-badge-tooltip-for-${hotbar?.name.get()}`} data-testid={hotbar ? `hotbar-menu-badge-tooltip-for-${hotbar.name.get()}` : undefined}
> >
{hotbar?.name.get()} {hotbar?.name.get()}
</Tooltip> </Tooltip>