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

Fix hotbar store tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-12-05 16:07:29 -05:00
parent 6c061165de
commit e414fbace5
2 changed files with 3 additions and 15 deletions

View File

@ -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");

View File

@ -53,7 +53,6 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
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)) {