From e414fbace553f3a9cbcbfcd20ab7870287177496 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Mon, 5 Dec 2022 16:07:29 -0500 Subject: [PATCH] Fix hotbar store tests Signed-off-by: Sebastian Malton --- src/common/__tests__/hotbar-store.test.ts | 17 +++-------------- src/common/hotbars/store.ts | 1 - 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/common/__tests__/hotbar-store.test.ts b/src/common/__tests__/hotbar-store.test.ts index a07311abcc..a0a618d4df 100644 --- a/src/common/__tests__/hotbar-store.test.ts +++ b/src/common/__tests__/hotbar-store.test.ts @@ -115,6 +115,7 @@ describe("HotbarStore", () => { di.permitSideEffects(fsInjectable); di.permitSideEffects(getConfigurationFileModelInjectable); + di.unoverride(getConfigurationFileModelInjectable); }); afterEach(() => { @@ -256,22 +257,12 @@ describe("HotbarStore", () => { }); it("throws if invalid arguments provided", () => { - // Prevent writing to stderr during this render. - const { error, warn } = console; - - console.error = jest.fn(); - console.warn = jest.fn(); - hotbarStore.addToHotbar(testCluster); expect(() => hotbarStore.restackItems(-5, 0)).toThrow(); expect(() => hotbarStore.restackItems(2, -1)).toThrow(); expect(() => hotbarStore.restackItems(14, 1)).toThrow(); expect(() => hotbarStore.restackItems(11, 112)).toThrow(); - - // Restore writing to stderr. - console.error = error; - console.warn = warn; }); it("checks if entity already pinned to hotbar", () => { @@ -285,7 +276,7 @@ describe("HotbarStore", () => { describe("given data from 5.0.0-beta.3 and version being 5.0.0-beta.10", () => { beforeEach(() => { - const configurationToBeMigrated = { + mockFs({ "some-directory-for-user-data": { "lens-hotbar-store.json": JSON.stringify({ __internal__: { @@ -345,9 +336,7 @@ describe("HotbarStore", () => { ], }), }, - }; - - mockFs(configurationToBeMigrated); + }); di.override(storeMigrationVersionInjectable, () => "5.0.0-beta.10"); diff --git a/src/common/hotbars/store.ts b/src/common/hotbars/store.ts index cfed5efd4f..709242f20e 100644 --- a/src/common/hotbars/store.ts +++ b/src/common/hotbars/store.ts @@ -53,7 +53,6 @@ export class HotbarStore extends BaseStore { if (typeof hotbar === "number") { if (hotbar >= 0 && hotbar < this.hotbars.length) { this._activeHotbarId = this.hotbars[hotbar].id; - console.log("in _activeHotbarId", this._activeHotbarId); } } else if (typeof hotbar === "string") { if (this.findById(hotbar)) {