mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Convert runMany and runManySync to use injectManyWithMeta + move to seperate package (#7244)
* Convert runMany and runManySync to use injectManyWithMeta Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup type errors due to new Runnable requirements Signed-off-by: Sebastian Malton <sebastian@malton.name> * Add documentation for verifyRunnablesAreDAG Signed-off-by: Sebastian Malton <sebastian@malton.name> * Simplify convertToWithIdWith Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move all utility functions to separate package Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move testing utilities to separate package Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move run-many and run-many-sync to separate package Signed-off-by: Sebastian Malton <sebastian@malton.name> * Replace all internal uses of utilities with new packages Signed-off-by: Sebastian Malton <sebastian@malton.name> * Use new @k8slens/run-many package in core Signed-off-by: Sebastian Malton <sebastian@malton.name> * Add dep to open-lens Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup type errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup uses of @k8slens/test-utils Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup getGlobalOverride Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move tests to new package too Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix type errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup uses of AsyncResult and autoBind Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup remaining import issues Signed-off-by: Sebastian Malton <sebastian@malton.name> * Finial fixups to fix build Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix lint Signed-off-by: Sebastian Malton <sebastian@malton.name> * Revert moving "testUsingFakeTime" to separate package - This fixes tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix integration tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix unit test failing due to spelling fix Signed-off-by: Sebastian Malton <sebastian@malton.name> --------- Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
ad9bafe2a5
commit
2789bcebcb
754 files changed
+2715
-2752
No files matched your search
+1
-1
@@ -5,7 +5,7 @@
|
||||
import type { MessageChannelListener } from "../../common/utils/channel/message-channel-listener-injection-token";
|
||||
import enlistMessageChannelListenerInjectableInRenderer from "../../renderer/utils/channel/channel-listeners/enlist-message-channel-listener.injectable";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import { getOrInsert, getOrInsertSet } from "../../common/utils";
|
||||
import { getOrInsert, getOrInsertSet } from "@k8slens/utilities";
|
||||
import type { SendToViewArgs } from "../../main/start-main-application/lens-window/application-window/create-lens-window.injectable";
|
||||
import { deserialize, serialize } from "v8";
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import { deserialize, serialize } from "v8";
|
||||
import type { MessageChannel, MessageChannelListener } from "../../common/utils/channel/message-channel-listener-injection-token";
|
||||
import enlistMessageChannelListenerInjectableInMain from "../../main/utils/channel/channel-listeners/enlist-message-channel-listener.injectable";
|
||||
import { getOrInsertSet } from "../../renderer/utils";
|
||||
import { getOrInsertSet } from "@k8slens/utilities";
|
||||
import sendToMainInjectable from "../../renderer/utils/channel/send-to-main.injectable";
|
||||
|
||||
export const overrideMessagingFromWindowToMain = (mainDi: DiContainer) => {
|
||||
|
||||
@@ -62,6 +62,7 @@ export const getOverrideFsWithFakes = () => {
|
||||
ensureDirSync,
|
||||
createReadStream: root.createReadStream as any,
|
||||
stat: root.promises.stat as any,
|
||||
unlink: root.promises.unlink,
|
||||
}));
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { act } from "@testing-library/react";
|
||||
|
||||
let usingFakeTime = false;
|
||||
|
||||
export const advanceFakeTime = (milliseconds: number) => {
|
||||
if (!usingFakeTime) {
|
||||
throw new Error("Tried to advance fake time but it was not enabled. Call useFakeTime() first.");
|
||||
}
|
||||
|
||||
act(() => {
|
||||
jest.advanceTimersByTime(milliseconds);
|
||||
});
|
||||
};
|
||||
|
||||
export const testUsingFakeTime = (dateTime = "2015-10-21T07:28:00Z") => {
|
||||
usingFakeTime = true;
|
||||
|
||||
jest.useFakeTimers();
|
||||
|
||||
jest.setSystemTime(new Date(dateTime));
|
||||
};
|
||||
Reference in new issue
Block a user