mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix unit tests
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
cef29fe708
commit
011183a825
@ -14,9 +14,8 @@ import { ClusterManager } from "../../cluster-manager";
|
||||
import clusterStoreInjectable from "../../../common/cluster-store/cluster-store.injectable";
|
||||
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
|
||||
import { createClusterInjectionToken } from "../../../common/cluster/create-cluster-injection-token";
|
||||
import directoryForKubeConfigsInjectable
|
||||
from "../../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
|
||||
|
||||
import directoryForKubeConfigsInjectable from "../../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
|
||||
import { ClusterStore } from "../../../common/cluster-store/cluster-store";
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
@ -57,6 +56,7 @@ describe("kubeconfig-sync.source tests", () => {
|
||||
afterEach(() => {
|
||||
mockFs.restore();
|
||||
ClusterManager.resetInstance();
|
||||
ClusterStore.resetInstance();
|
||||
});
|
||||
|
||||
describe("configsToModels", () => {
|
||||
|
||||
@ -8,19 +8,20 @@ import type { Cluster } from "../../common/cluster/cluster";
|
||||
import { ContextHandler } from "./context-handler";
|
||||
import createKubeAuthProxyInjectable from "../kube-auth-proxy/create-kube-auth-proxy.injectable";
|
||||
import { getKubeAuthProxyCertificate } from "../kube-auth-proxy/get-kube-auth-proxy-certificate";
|
||||
import URLParse from "url-parse";
|
||||
|
||||
const createContextHandlerInjectable = getInjectable({
|
||||
id: "create-context-handler",
|
||||
|
||||
instantiate: (di) => {
|
||||
return (cluster: Cluster) => {
|
||||
const clusterUrl = new URL(cluster.apiUrl);
|
||||
const clusterUrl = new URLParse(cluster.apiUrl);
|
||||
|
||||
const dependencies = {
|
||||
createKubeAuthProxy: di.inject(createKubeAuthProxyInjectable),
|
||||
authProxyCa: getKubeAuthProxyCertificate(clusterUrl.hostname, selfsigned.generate).cert,
|
||||
};
|
||||
|
||||
|
||||
return new ContextHandler(dependencies, cluster);
|
||||
};
|
||||
},
|
||||
|
||||
@ -57,8 +57,9 @@ const NonInjectedLogsDockTab = observer(({ className, tab, model, subscribeStore
|
||||
setTimeout(() => {
|
||||
const overlay = document.querySelector(".PodLogs .list span.active");
|
||||
|
||||
if (!overlay) return;
|
||||
overlay.scrollIntoViewIfNeeded();
|
||||
if (typeof overlay?.scrollIntoViewIfNeeded === "function") {
|
||||
overlay.scrollIntoViewIfNeeded();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
|
||||
|
||||
@ -81,7 +81,9 @@ export class Tab extends React.PureComponent<TabProps> {
|
||||
}
|
||||
|
||||
scrollIntoView() {
|
||||
this.ref.current?.scrollIntoViewIfNeeded();
|
||||
if (typeof this.ref.current?.scrollIntoViewIfNeeded === "function") {
|
||||
this.ref.current.scrollIntoViewIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
|
||||
2
types/dom.d.ts
vendored
2
types/dom.d.ts
vendored
@ -6,7 +6,7 @@ export {};
|
||||
|
||||
declare global {
|
||||
interface Element {
|
||||
scrollIntoViewIfNeeded(opt_center?: boolean): void;
|
||||
scrollIntoViewIfNeeded?(opt_center?: boolean): void;
|
||||
}
|
||||
|
||||
interface Window {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user