mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove no longer necessary mocks
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
3b0fd91564
commit
e7654aee33
@ -3,7 +3,6 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import broadcastMessageInjectable from "../../common/ipc/broadcast-message.injectable";
|
import broadcastMessageInjectable from "../../common/ipc/broadcast-message.injectable";
|
||||||
import { Console } from "console";
|
|
||||||
import type { Cluster } from "../../common/cluster/cluster";
|
import type { Cluster } from "../../common/cluster/cluster";
|
||||||
import { Kubectl } from "../kubectl/kubectl";
|
import { Kubectl } from "../kubectl/kubectl";
|
||||||
import { getDiForUnitTesting } from "../getDiForUnitTesting";
|
import { getDiForUnitTesting } from "../getDiForUnitTesting";
|
||||||
@ -25,8 +24,6 @@ import pathExistsInjectable from "../../common/fs/path-exists.injectable";
|
|||||||
import readJsonSyncInjectable from "../../common/fs/read-json-sync.injectable";
|
import readJsonSyncInjectable from "../../common/fs/read-json-sync.injectable";
|
||||||
import writeJsonSyncInjectable from "../../common/fs/write-json-sync.injectable";
|
import writeJsonSyncInjectable from "../../common/fs/write-json-sync.injectable";
|
||||||
|
|
||||||
console = new Console(process.stdout, process.stderr); // fix mockFS
|
|
||||||
|
|
||||||
describe("create clusters", () => {
|
describe("create clusters", () => {
|
||||||
let cluster: Cluster;
|
let cluster: Cluster;
|
||||||
let createCluster: CreateCluster;
|
let createCluster: CreateCluster;
|
||||||
|
|||||||
@ -7,22 +7,6 @@ import type { LensApiRequest, Route } from "../router/route";
|
|||||||
import staticFileRouteInjectable from "../routes/files/static-file-route.injectable";
|
import staticFileRouteInjectable from "../routes/files/static-file-route.injectable";
|
||||||
import { getDiForUnitTesting } from "../getDiForUnitTesting";
|
import { getDiForUnitTesting } from "../getDiForUnitTesting";
|
||||||
|
|
||||||
jest.mock("electron", () => ({
|
|
||||||
app: {
|
|
||||||
getVersion: () => "99.99.99",
|
|
||||||
getName: () => "lens",
|
|
||||||
setName: jest.fn(),
|
|
||||||
setPath: jest.fn(),
|
|
||||||
getPath: () => "tmp",
|
|
||||||
getLocale: () => "en",
|
|
||||||
setLoginItemSettings: jest.fn(),
|
|
||||||
},
|
|
||||||
ipcMain: {
|
|
||||||
on: jest.fn(),
|
|
||||||
handle: jest.fn(),
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe("static-file-route", () => {
|
describe("static-file-route", () => {
|
||||||
let handleStaticFileRoute: Route<Buffer, "/{path*}">;
|
let handleStaticFileRoute: Route<Buffer, "/{path*}">;
|
||||||
|
|
||||||
|
|||||||
@ -17,15 +17,6 @@ import { LensRendererExtension } from "../../../../extensions/lens-renderer-exte
|
|||||||
import type { WelcomeBannerRegistration } from "../welcome-banner-items/welcome-banner-registration";
|
import type { WelcomeBannerRegistration } from "../welcome-banner-items/welcome-banner-registration";
|
||||||
import currentlyInClusterFrameInjectable from "../../../routes/currently-in-cluster-frame.injectable";
|
import currentlyInClusterFrameInjectable from "../../../routes/currently-in-cluster-frame.injectable";
|
||||||
|
|
||||||
jest.mock("electron", () => ({
|
|
||||||
ipcRenderer: {
|
|
||||||
on: jest.fn(),
|
|
||||||
},
|
|
||||||
app: {
|
|
||||||
getPath: () => "tmp",
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe("<Welcome/>", () => {
|
describe("<Welcome/>", () => {
|
||||||
let render: DiRender;
|
let render: DiRender;
|
||||||
let di: DiContainer;
|
let di: DiContainer;
|
||||||
|
|||||||
@ -13,12 +13,6 @@ import type { DiRender } from "../../test-utils/renderFor";
|
|||||||
import { renderFor } from "../../test-utils/renderFor";
|
import { renderFor } from "../../test-utils/renderFor";
|
||||||
import directoryForLensLocalStorageInjectable from "../../../../common/directory-for-lens-local-storage/directory-for-lens-local-storage.injectable";
|
import directoryForLensLocalStorageInjectable from "../../../../common/directory-for-lens-local-storage/directory-for-lens-local-storage.injectable";
|
||||||
|
|
||||||
jest.mock("electron", () => ({
|
|
||||||
app: {
|
|
||||||
getPath: () => "/foo",
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
const tolerations: Toleration[] =[
|
const tolerations: Toleration[] =[
|
||||||
{
|
{
|
||||||
key: "CriticalAddonsOnly",
|
key: "CriticalAddonsOnly",
|
||||||
|
|||||||
@ -20,34 +20,6 @@ import getConfigurationFileModelInjectable from "../../../../common/get-configur
|
|||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import hostedClusterIdInjectable from "../../../cluster-frame-context/hosted-cluster-id.injectable";
|
import hostedClusterIdInjectable from "../../../cluster-frame-context/hosted-cluster-id.injectable";
|
||||||
|
|
||||||
jest.mock("electron", () => ({
|
|
||||||
app: {
|
|
||||||
getVersion: () => "99.99.99",
|
|
||||||
getName: () => "lens",
|
|
||||||
setName: jest.fn(),
|
|
||||||
setPath: jest.fn(),
|
|
||||||
getPath: () => "tmp",
|
|
||||||
getLocale: () => "en",
|
|
||||||
setLoginItemSettings: jest.fn(),
|
|
||||||
},
|
|
||||||
ipcMain: {
|
|
||||||
on: jest.fn(),
|
|
||||||
handle: jest.fn(),
|
|
||||||
},
|
|
||||||
ipcRenderer: {
|
|
||||||
on: jest.fn(),
|
|
||||||
invoke: jest.fn(),
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
Object.defineProperty(window, "ResizeObserver", {
|
|
||||||
writable: true,
|
|
||||||
value: jest.fn().mockImplementation(() => ({
|
|
||||||
observe: jest.fn(),
|
|
||||||
disconnect: jest.fn(),
|
|
||||||
})),
|
|
||||||
});
|
|
||||||
|
|
||||||
const initialTabs: DockTab[] = [
|
const initialTabs: DockTab[] = [
|
||||||
{ id: "terminal", kind: TabKind.TERMINAL, title: "Terminal", pinned: false },
|
{ id: "terminal", kind: TabKind.TERMINAL, title: "Terminal", pinned: false },
|
||||||
{ id: "create", kind: TabKind.CREATE_RESOURCE, title: "Create resource", pinned: false },
|
{ id: "create", kind: TabKind.CREATE_RESOURCE, title: "Create resource", pinned: false },
|
||||||
|
|||||||
@ -4,21 +4,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { SearchStore } from "./search-store";
|
import { SearchStore } from "./search-store";
|
||||||
import { Console } from "console";
|
|
||||||
import { stdout, stderr } from "process";
|
|
||||||
import { getDiForUnitTesting } from "../getDiForUnitTesting";
|
import { getDiForUnitTesting } from "../getDiForUnitTesting";
|
||||||
import directoryForUserDataInjectable
|
import directoryForUserDataInjectable from "../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||||
from "../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
|
||||||
import searchStoreInjectable from "./search-store.injectable";
|
import searchStoreInjectable from "./search-store.injectable";
|
||||||
|
|
||||||
jest.mock("electron", () => ({
|
|
||||||
app: {
|
|
||||||
getPath: () => "/foo",
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
console = new Console(stdout, stderr);
|
|
||||||
|
|
||||||
const logs = [
|
const logs = [
|
||||||
"1:M 30 Oct 2020 16:17:41.553 # Connection with replica 172.17.0.12:6379 lost",
|
"1:M 30 Oct 2020 16:17:41.553 # Connection with replica 172.17.0.12:6379 lost",
|
||||||
"1:M 30 Oct 2020 16:17:41.623 * Replica 172.17.0.12:6379 asks for synchronization",
|
"1:M 30 Oct 2020 16:17:41.623 * Replica 172.17.0.12:6379 asks for synchronization",
|
||||||
@ -31,7 +20,7 @@ describe("search store tests", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const di = getDiForUnitTesting({ doGeneralOverrides: true });
|
const di = getDiForUnitTesting({ doGeneralOverrides: true });
|
||||||
|
|
||||||
di.override(directoryForUserDataInjectable, () => "some-directory-for-user-data");
|
di.override(directoryForUserDataInjectable, () => "/some-directory-for-user-data");
|
||||||
|
|
||||||
searchStore = di.inject(searchStoreInjectable);
|
searchStore = di.inject(searchStoreInjectable);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user