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

Fix KubeAuthProxy unit tests (#1084)

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala 2020-10-14 17:10:58 +03:00 committed by GitHub
parent 770c6b80f1
commit 81575b333a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@ import { KubeAuthProxy } from "../kube-auth-proxy"
import { getFreePort } from "../port" import { getFreePort } from "../port"
import { broadcastIpc } from "../../common/ipc" import { broadcastIpc } from "../../common/ipc"
import { ChildProcess, spawn, SpawnOptions } from "child_process" import { ChildProcess, spawn, SpawnOptions } from "child_process"
import { Kubectl } from "../kubectl" import { bundledKubectlPath, Kubectl } from "../kubectl"
import { mock, MockProxy } from 'jest-mock-extended'; import { mock, MockProxy } from 'jest-mock-extended';
import { waitUntilUsed } from 'tcp-port-used'; import { waitUntilUsed } from 'tcp-port-used';
import { Readable } from "stream" import { Readable } from "stream"
@ -81,7 +81,7 @@ describe("kube auth proxy tests", () => {
return mockedCP.stdout return mockedCP.stdout
}) })
mockSpawn.mockImplementationOnce((command: string, args: readonly string[], options: SpawnOptions): ChildProcess => { mockSpawn.mockImplementationOnce((command: string, args: readonly string[], options: SpawnOptions): ChildProcess => {
expect(command).toBe(Kubectl.bundledKubectlPath) expect(command).toBe(bundledKubectlPath())
return mockedCP return mockedCP
}) })
mockWaitUntilUsed.mockReturnValueOnce(Promise.resolve()) mockWaitUntilUsed.mockReturnValueOnce(Promise.resolve())