mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 06:40:22 +08:00
29 lines
1.2 KiB
JavaScript
29 lines
1.2 KiB
JavaScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import {
|
|
looksLikeDesktopName,
|
|
isDesktopExecutable,
|
|
isOfficialHarnessExecutable,
|
|
} from "../lib/desktop.js";
|
|
import { detectSurface, pathLooksDesktop, isCommunityElectronHost } from "../lib/surface.js";
|
|
|
|
test("DSH NEXT 路径和 exe 按桌面认", () => {
|
|
assert.equal(looksLikeDesktopName("C:/Users/me/AppData/Local/Programs/DSH NEXT/DSH NEXT.exe"), true);
|
|
assert.equal(isDesktopExecutable("C:/Users/me/AppData/Local/Programs/DSH NEXT/DSH NEXT.exe"), true);
|
|
assert.equal(isOfficialHarnessExecutable("C:/Users/me/AppData/Local/Programs/DSH NEXT/DSH NEXT.exe"), true);
|
|
assert.equal(pathLooksDesktop("C:/Users/me/AppData/Local/Programs/DSH NEXT/DSH NEXT.exe"), true);
|
|
});
|
|
|
|
test("DSH NEXT 即使 DSH_SURFACE=web 也判桌面", () => {
|
|
const input = {
|
|
env: { DSH_SURFACE: "web", DSH_PROFILE: "dsh-next" },
|
|
execPath: "C:\\\\Users\\\\me\\\\AppData\\\\Local\\\\Programs\\\\DSH NEXT\\\\DSH NEXT.exe",
|
|
};
|
|
assert.equal(isCommunityElectronHost(input), true);
|
|
assert.equal(detectSurface(input), "desktop");
|
|
});
|
|
|
|
test("普通路径不会因为带 app.asar 就当桌面", () => {
|
|
assert.equal(pathLooksDesktop("/tmp/random-app/resources/app.asar"), false);
|
|
});
|