fix cluster.test.ts tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2022-05-04 08:45:53 -04:00
1 parent 199f142559
commit ffb840f0ed
6 files changed
+36 -58

No files matched your search

+1 -26
View File
@@ -3,32 +3,6 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
const logger = {
silly: jest.fn(),
debug: jest.fn(),
log: jest.fn(),
info: jest.fn(),
error: jest.fn(),
crit: jest.fn(),
};
jest.mock("winston", () => ({
format: {
colorize: jest.fn(),
combine: jest.fn(),
simple: jest.fn(),
label: jest.fn(),
timestamp: jest.fn(),
printf: jest.fn(),
splat: jest.fn(),
},
createLogger: jest.fn().mockReturnValue(logger),
transports: {
Console: jest.fn(),
File: jest.fn(),
},
}));
jest.mock("../../common/ipc");
jest.mock("request");
jest.mock("request-promise-native");
@@ -109,6 +83,7 @@ describe("create clusters", () => {
});
afterEach(() => {
cluster.disconnect();
mockFs.restore();
});
@@ -12,6 +12,7 @@ import createContextHandlerInjectable from "../context-handler/create-context-ha
import { createClusterInjectionToken } from "../../common/cluster/create-cluster-injection-token";
import authorizationReviewInjectable from "../../common/cluster/authorization-review.injectable";
import listNamespacesInjectable from "../../common/cluster/list-namespaces.injectable";
import loggerInjectable from "../../common/logger.injectable";
const createClusterInjectable = getInjectable({
id: "create-cluster",
@@ -24,6 +25,7 @@ const createClusterInjectable = getInjectable({
createContextHandler: di.inject(createContextHandlerInjectable),
createAuthorizationReview: di.inject(authorizationReviewInjectable),
createListNamespaces: di.inject(listNamespacesInjectable),
logger: di.inject(loggerInjectable),
};
return (model) => new Cluster(dependencies, model);
+1
View File
@@ -108,6 +108,7 @@ export const getDiForUnitTesting = (
debug: noop,
error: (message: string, ...args: any) => console.error(message, ...args),
info: noop,
silly: noop,
}));
}