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

Fix test failures due to incomplete overrides

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-12-02 16:27:32 -05:00
parent 4875f24af3
commit cf0ca414ea
3 changed files with 24 additions and 5 deletions

View File

@ -12,7 +12,7 @@ import checkForPlatformUpdatesInjectable from "./check-for-platform-updates.inje
import type { UpdateChannel, ReleaseChannel } from "../../../common/update-channels";
import { getPromiseStatus } from "../../../../../common/test-utils/get-promise-status";
import loggerInjectable from "../../../../../common/logger.injectable";
import type { Logger } from "../../../../../common/logger";
import { noop } from "../../../../../common/utils";
describe("check-for-platform-updates", () => {
let checkForPlatformUpdates: CheckForPlatformUpdates;
@ -37,7 +37,13 @@ describe("check-for-platform-updates", () => {
logErrorMock = jest.fn();
di.override(loggerInjectable, () => ({ error: logErrorMock }) as unknown as Logger);
di.override(loggerInjectable, () => ({
error: logErrorMock,
debug: noop,
info: noop,
silly: noop,
warn: noop,
}));
checkForPlatformUpdates = di.inject(checkForPlatformUpdatesInjectable);
});

View File

@ -12,7 +12,7 @@ import asyncFn from "@async-fn/jest";
import { getPromiseStatus } from "../../../../../common/test-utils/get-promise-status";
import type { DiContainer } from "@ogre-tools/injectable";
import loggerInjectable from "../../../../../common/logger.injectable";
import type { Logger } from "../../../../../common/logger";
import { noop } from "../../../../../common/utils";
describe("download-platform-update", () => {
let downloadPlatformUpdate: DownloadPlatformUpdate;
@ -43,7 +43,13 @@ describe("download-platform-update", () => {
di.override(electronUpdaterInjectable, () => electronUpdaterFake);
logErrorMock = jest.fn();
di.override(loggerInjectable, () => ({ error: logErrorMock }) as unknown as Logger);
di.override(loggerInjectable, () => ({
error: logErrorMock,
debug: noop,
info: noop,
silly: noop,
warn: noop,
}));
downloadPlatformUpdate = di.inject(downloadPlatformUpdateInjectable);
});

View File

@ -16,6 +16,7 @@ import loggerInjectable from "../../common/logger.injectable";
import type { Logger } from "../../common/logger";
import requestPublicHelmRepositoriesInjectable from "./child-features/preferences/renderer/adding-of-public-helm-repository/public-helm-repositories/request-public-helm-repositories.injectable";
import showErrorNotificationInjectable from "../../renderer/components/notifications/show-error-notification.injectable";
import { noop } from "../../common/utils";
describe("listing active helm repositories in preferences", () => {
let builder: ApplicationBuilder;
@ -32,7 +33,13 @@ describe("listing active helm repositories in preferences", () => {
execFileMock = asyncFn();
showErrorNotificationMock = jest.fn();
loggerStub = { error: jest.fn() } as unknown as Logger;
loggerStub = {
error: jest.fn(),
debug: noop,
info: noop,
silly: noop,
warn: noop,
};
builder.beforeApplicationStart((mainDi) => {
mainDi.override(readYamlFileInjectable, () => readYamlFileMock);