Implement a lot of technical requirements for behavioural unit tests

Note: the crux of this was to make routing env-agnostic, and not based on URLs as magic strings, but instead something type-enforced.

Note: extension-based routes comply to same exact interface by "late-registering" their routes when installed. Routes are just injectables.

Note: another chunk of global shared state is no more.

Note: a lot of explicit side effects have been cornered to injectables.

Note: a lot of stuff has become reactive as part if this.

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne SavolainenandMikko Aspiala committed 2022-03-31 15:13:26 +03:00
1 parent 086604630a
commit 5c8ca2c038
523 files changed
+11727 -5541

No files matched your search

@@ -0,0 +1,25 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import ipcRendererInjectable from "./ipc-renderer/ipc-renderer.injectable";
import type {
IpcChannelListener,
} from "../../ipc-channel-listeners/ipc-channel-listener-injection-token";
const registerIpcChannelListenerInjectable = getInjectable({
id: "register-ipc-channel-listener",
instantiate: (di) => {
const ipc = di.inject(ipcRendererInjectable);
return ({ channel, handle }: IpcChannelListener) => {
ipc.on(channel.name, (_, data) => {
handle(data);
});
};
},
});
export default registerIpcChannelListenerInjectable;