mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
feat: Introduce minimal Feature for app paths
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
1 parent
dd62e034b7
commit
5101101da2
12 files changed
+187
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import joinPathsInjectable from "../join-paths/join-paths.injectable";
|
||||
import path from "path";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { appPathsInjectionToken } from "../app-paths-injection-token";
|
||||
|
||||
const doGlobalOverrides = (di: DiContainer) => {
|
||||
// Note: implementation of app-paths is still in OpenLens.
|
||||
// Therefore, a stub is registered in its place to serve spirit of unit testing.
|
||||
const appPathsStubInjectable = getInjectable({
|
||||
id: "app-paths-stub",
|
||||
|
||||
instantiate: () => ({
|
||||
appData: "some-app-data-directory",
|
||||
cache: "some-cache-directory",
|
||||
crashDumps: "some-crash-dumps-directory",
|
||||
desktop: "some-desktop-directory",
|
||||
documents: "some-documents-directory",
|
||||
downloads: "some-downloads-directory",
|
||||
exe: "some-exe-directory",
|
||||
home: "some-home-directory",
|
||||
logs: "some-logs-directory",
|
||||
module: "some-module-directory",
|
||||
music: "some-music-directory",
|
||||
pictures: "some-pictures-directory",
|
||||
recent: "some-recent-directory",
|
||||
temp: "some-temp-directory",
|
||||
videos: "some-videos-directory",
|
||||
userData: "some-user-data-directory",
|
||||
}),
|
||||
|
||||
injectionToken: appPathsInjectionToken,
|
||||
});
|
||||
|
||||
di.register(appPathsStubInjectable);
|
||||
|
||||
di.override(joinPathsInjectable, () => path.posix.join);
|
||||
};
|
||||
|
||||
export const testUtils = { doGlobalOverrides };
|
||||
Reference in new issue
Block a user