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 () => {
builder = getApplicationBuilder();
builder.setEnvironmentToClusterFrame();
builder.afterWindowStart(({ windowDi }) => {
await builder.setEnvironmentToClusterFrame();
await builder.afterWindowStart(({ windowDi }) => {
const apiManager = windowDi.inject(apiManagerInjectable);
customResourceDefinitionStore = windowDi.inject(customResourceDefinitionStoreInjectable);

View File

@ -47,7 +47,7 @@ describe("hotbar-welcome-page-migration", () => {
let migration: MigrationDeclaration;
let store: MigrationStore;
const storeModel = new Map();
const storeModel = new Map<string, unknown>();
beforeEach(() => {
migration = di.inject(v640HotbarStoreMigrationInjectable);
@ -63,25 +63,29 @@ describe("hotbar-welcome-page-migration", () => {
storeModel.set("hotbars", [emptyHotbar]);
store = {
path: "some-path",
get: (key: string) => storeModel.get(key),
set: (key: string, value: any) => storeModel.set(key, value),
delete: (key: string) => storeModel.delete(key),
has: (key: string) => storeModel.has(key),
get: (key) => storeModel.get(key),
set: (key, value) => storeModel.set(key, value),
delete: (key) => storeModel.delete(key),
has: (key) => storeModel.has(key),
clear: () => storeModel.clear(),
};
} as MigrationStore;
});
it("given first hotbar is empty, adds welcome page to first place", () => {
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", () => {
setFirstHotbarItems(store, [someItem]);
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", () => {
@ -90,9 +94,10 @@ describe("hotbar-welcome-page-migration", () => {
setFirstHotbarItems(store, fullHotbarItems);
migration.run(store);
const hotbars = storeModel.get("hotbars") as HotbarData[];
expect(storeModel.get("hotbars")[0].items).toEqual(fullHotbarItems);
expect(storeModel.get("hotbars")[0].items).not.toContain(welcomeHotbarItem);
expect(hotbars[0]?.items).toEqual(fullHotbarItems);
expect(hotbars[0]?.items).not.toContain(welcomeHotbarItem);
});
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);
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}
onMouseEnter={onMouseEvent}
onMouseLeave={onMouseEvent}
data-testid={`hotbar-menu-badge-for-${hotbar?.name.get()}`}
data-testid={hotbar ? `hotbar-menu-badge-for-${hotbar.name.get()}` : undefined}
/>
<Tooltip
visible={tooltipVisible}
targetId="hotbarIndex"
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()}
</Tooltip>