mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Upgrade and adapt to new version of libraries in ogre-tools (#7241)
* Update injectable version Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Adapt to new version of ogre-tools Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Fix "lint:fix" -command in core Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> --------- Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
1 parent
b2160ae06c
commit
003dc44681
20 files changed
+176
-97
No files matched your search
@@ -19,7 +19,10 @@ import asyncFn from "@async-fn/jest";
|
||||
import { getPromiseStatus } from "../../test-utils/get-promise-status";
|
||||
import { runInAction } from "mobx";
|
||||
import type { RequestChannelHandler } from "../../../main/utils/channel/channel-listeners/listener-tokens";
|
||||
import { getRequestChannelListenerInjectable } from "../../../main/utils/channel/channel-listeners/listener-tokens";
|
||||
import {
|
||||
getRequestChannelListenerInjectable,
|
||||
requestChannelListenerInjectionToken,
|
||||
} from "../../../main/utils/channel/channel-listeners/listener-tokens";
|
||||
|
||||
type TestMessageChannel = MessageChannel<string>;
|
||||
type TestRequestChannel = RequestChannel<string, string>;
|
||||
@@ -199,21 +202,32 @@ describe("channel", () => {
|
||||
it("when registering multiple handlers for the same channel, throws", async () => {
|
||||
const applicationBuilder = getApplicationBuilder();
|
||||
|
||||
const testChannelListenerInMainInjectable = getRequestChannelListenerInjectable({
|
||||
channel: testRequestChannel,
|
||||
handler: () => () => "some-value",
|
||||
});
|
||||
const testChannelListenerInMain2Injectable = getRequestChannelListenerInjectable({
|
||||
channel: testRequestChannel,
|
||||
handler: () => () => "some-other-value",
|
||||
const someChannelListenerInjectable = getInjectable({
|
||||
id: "some-channel-listener",
|
||||
|
||||
instantiate: () => ({
|
||||
channel: testRequestChannel,
|
||||
handler: () => () => "irrelevant",
|
||||
}),
|
||||
|
||||
injectionToken: requestChannelListenerInjectionToken,
|
||||
});
|
||||
|
||||
testChannelListenerInMain2Injectable.id += "2";
|
||||
const someOtherChannelListenerInjectable = getInjectable({
|
||||
id: "some-other-channel-listener",
|
||||
|
||||
instantiate: () => ({
|
||||
channel: testRequestChannel,
|
||||
handler: () => () => "irrelevant",
|
||||
}),
|
||||
|
||||
injectionToken: requestChannelListenerInjectionToken,
|
||||
});
|
||||
|
||||
applicationBuilder.beforeApplicationStart((mainDi) => {
|
||||
runInAction(() => {
|
||||
mainDi.register(testChannelListenerInMainInjectable);
|
||||
mainDi.register(testChannelListenerInMain2Injectable);
|
||||
mainDi.register(someChannelListenerInjectable);
|
||||
mainDi.register(someOtherChannelListenerInjectable);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ const withOrphanPromiseInjectable = getInjectable({
|
||||
toBeDecorated,
|
||||
withErrorLoggingFor(() => "Orphan promise rejection encountered"),
|
||||
withErrorSuppression,
|
||||
);
|
||||
) as ((...args: any[]) => any);
|
||||
|
||||
decorated(...args);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user