mirror of
https://github.com/Pandipipas/scoreko-electron-dev.git
synced 2026-06-06 05:32:06 +00:00
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import path from "node:path";
|
|
import test from "node:test";
|
|
|
|
import { AppRuntimeConfig } from "../main/config/runtime-config";
|
|
import { resolveAppIconPath } from "../main/windows/icon-path";
|
|
|
|
function getBaseConfig(): AppRuntimeConfig {
|
|
return {
|
|
title: "Scoreko",
|
|
userModelId: "com.scoreko.desktop",
|
|
userDataDirectoryName: "scoreko",
|
|
nodecgPort: "9090",
|
|
bundleName: "scoreko-dev",
|
|
mainDashboardRoute: "dashboard/scoreko-dev/main.html?standalone=true",
|
|
loadingDashboardRoute: "dashboard/loading/main.html?standalone=true",
|
|
loadDelayMs: 10000,
|
|
startupTimeoutMs: 30000,
|
|
nodecgKillTimeoutMs: 2500,
|
|
updatesEnabled: true,
|
|
updateAssetPattern: "Scoreko-setup-.*\\.exe$",
|
|
updateCheckDelayMs: 5000,
|
|
};
|
|
}
|
|
|
|
test("resolveAppIconPath prioritizes iconPathOverride when present", () => {
|
|
const appConfig: AppRuntimeConfig = {
|
|
...getBaseConfig(),
|
|
iconPathOverride: "/custom/icon.ico",
|
|
};
|
|
|
|
const iconPath = resolveAppIconPath(appConfig, "/app", (candidate) => candidate === "/custom/icon.ico");
|
|
|
|
assert.equal(iconPath, "/custom/icon.ico");
|
|
});
|
|
|
|
test("resolveAppIconPath falls back to the first existing default icon", () => {
|
|
const appConfig = getBaseConfig();
|
|
const expectedIconPath = path.join("/app", "static", "icons", "icon.png");
|
|
|
|
const iconPath = resolveAppIconPath(appConfig, "/app", (candidate) => candidate === expectedIconPath);
|
|
|
|
assert.equal(iconPath, expectedIconPath);
|
|
});
|
|
|
|
test("resolveAppIconPath returns undefined when no icons exist", () => {
|
|
const appConfig = getBaseConfig();
|
|
|
|
const iconPath = resolveAppIconPath(appConfig, "/app", () => false);
|
|
|
|
assert.equal(iconPath, undefined);
|
|
});
|