Merge remote-tracking branch 'origin/master' into eliminate-gst-from-app-paths

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen committed 2022-01-11 13:56:23 +02:00
commit 8d87bd0985
80 files changed
+1822 -1271

No files matched your search

@@ -22,25 +22,33 @@ import electronAppInjectable from "./electron-app/electron-app.injectable";
import getElectronAppPathInjectable from "./get-electron-app-path.injectable";
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
import type { App } from "electron";
import registerChannelInjectable from "../register-channel/register-channel.injectable";
describe("get-electron-app-path", () => {
let getElectronAppPath: (name: string) => string | null;
beforeEach(() => {
const di = getDiForUnitTesting();
beforeEach(async () => {
const di = getDiForUnitTesting({ doGeneralOverrides: false });
const appStub = {
name: "some-app-name",
getPath: (name: string) => {
if (name !== "some-existing-name") {
throw new Error("irrelevant");
}
return "some-existing-app-path";
},
// eslint-disable-next-line unused-imports/no-unused-vars-ts
setPath: (_, __) => undefined,
} as App;
di.override(electronAppInjectable, () => appStub);
di.override(registerChannelInjectable, () => () => undefined);
await di.runSetups();
getElectronAppPath = di.inject(getElectronAppPathInjectable);
});
@@ -54,6 +62,6 @@ describe("get-electron-app-path", () => {
it("given app path does not exist, when called, returns null", () => {
const actual = getElectronAppPath("some-non-existing-name");
expect(actual).toBe(null);
expect(actual).toBe("");
});
});
@@ -31,6 +31,6 @@ export const getElectronAppPath =
try {
return app.getPath(name);
} catch (e) {
return null;
return "";
}
};