Fix tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2021-11-05 10:25:19 -04:00
1 parent cd0a68c347
commit 3d860cb036
2 files changed
+6 -6

No files matched your search

+1 -1
View File
@@ -123,7 +123,7 @@ export enum ClusterStatus {
}
/**
* The message format for the "kube-auth:<cluster-id>" channels
* The message format for the "cluster:<cluster-id>:connection-update" channels
*/
export interface KubeAuthUpdate {
message: string;
+5 -5
View File
@@ -177,34 +177,34 @@ describe("kube auth proxy tests", () => {
await proxy.run();
listeners["error"]({ message: "foobarbat" });
expect(mockBroadcastIpc).toBeCalledWith("kube-auth:foobar", { data: "foobarbat", error: true });
expect(mockBroadcastIpc).toBeCalledWith("cluster:foobar:connection-update", { data: "foobarbat", error: true });
});
it("should call spawn and broadcast exit", async () => {
await proxy.run();
listeners["exit"](0);
expect(mockBroadcastIpc).toBeCalledWith("kube-auth:foobar", { data: "proxy exited with code: 0", error: false });
expect(mockBroadcastIpc).toBeCalledWith("cluster:foobar:connection-update", { data: "proxy exited with code: 0", error: false });
});
it("should call spawn and broadcast errors from stderr", async () => {
await proxy.run();
listeners["stderr/data"]("an error");
expect(mockBroadcastIpc).toBeCalledWith("kube-auth:foobar", { data: "an error", error: true });
expect(mockBroadcastIpc).toBeCalledWith("cluster:foobar:connection-update", { data: "an error", error: true });
});
it("should call spawn and broadcast stdout serving info", async () => {
await proxy.run();
expect(mockBroadcastIpc).toBeCalledWith("kube-auth:foobar", { data: "Authentication proxy started\n" });
expect(mockBroadcastIpc).toBeCalledWith("cluster:foobar:connection-update", { data: "Authentication proxy started\n" });
});
it("should call spawn and broadcast stdout other info", async () => {
await proxy.run();
listeners["stdout/data"]("some info");
expect(mockBroadcastIpc).toBeCalledWith("kube-auth:foobar", { data: "some info" });
expect(mockBroadcastIpc).toBeCalledWith("cluster:foobar:connection-update", { data: "some info" });
});
});
});