mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
|
|
import loggerInjectable from "../../../common/logger.injectable";
|
|
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
|
|
import defaultWebsocketApiParamsInjectable from "../default-websocket-api-params.injectable";
|
|
import websocketAgentInjectable from "../websocket-agent.injectable";
|
|
import type { WebSocketEvents } from "../websocket-api";
|
|
import { WebSocketApi } from "../websocket-api";
|
|
|
|
class TestWebSocketApi extends WebSocketApi<WebSocketEvents> {
|
|
flush(): void {
|
|
super.flush();
|
|
}
|
|
}
|
|
|
|
describe("WebsocketApi tests", () => {
|
|
let api: TestWebSocketApi;
|
|
|
|
beforeEach(() => {
|
|
const di = getDiForUnitTesting({ doGeneralOverrides: true });
|
|
|
|
api = new TestWebSocketApi({
|
|
defaultParams: di.inject(defaultWebsocketApiParamsInjectable),
|
|
logger: di.inject(loggerInjectable),
|
|
websocketAgent: di.inject(websocketAgentInjectable),
|
|
}, {});
|
|
});
|
|
|
|
describe("before connection", () => {
|
|
it("does not hang when flush is called", () => {
|
|
api.flush();
|
|
});
|
|
|
|
describe("when a message has been sent", () => {
|
|
beforeEach(() => {
|
|
api.send("a command");
|
|
});
|
|
|
|
it("does not hang when flush is called", () => {
|
|
api.flush();
|
|
});
|
|
});
|
|
});
|
|
});
|