fix(support-info): show Windows marketing name in support info

This commit is contained in:
弈秋 authored and GitHub committed 2026-09-25 15:54:58 +08:00
1 parent e0da2d09d3
commit 79d172fcff
2 files changed
+55 -1

No files matched your search

+32 -1
View File
@@ -1,6 +1,6 @@
import { strict as assert } from "node:assert";
import { test } from "vitest";
import { buildAppSupportInfoRows, formatAppSupportInfoForClipboard, normalizeSupportInfoVersion } from "../../apps/desktop/src/lib/app/supportInfo.ts";
import { buildAppSupportInfoRows, formatAppSupportInfoForClipboard, formatSupportInfoOperatingSystem, normalizeSupportInfoVersion, windowsMarketingName } from "../../apps/desktop/src/lib/app/supportInfo.ts";
import type { AppSupportInfoLabels } from "../../apps/desktop/src/lib/app/supportInfo.ts";
import type { AppSupportInfo } from "../../apps/desktop/src/lib/backend/tauri.ts";
@@ -49,3 +49,34 @@ test("formats support info clipboard text in stable issue-friendly order", () =>
["DBX Version: v0.5.50", "Runtime: Desktop", "Operating System: macOS 15.5", "Architecture: aarch64"].join("\n"),
);
});
test("maps Windows kernel build to its marketing name", () => {
assert.equal(windowsMarketingName("10.0.26200.9457"), "Windows 11");
assert.equal(windowsMarketingName("10.0.22000.1"), "Windows 11");
assert.equal(windowsMarketingName("10.0.19045.5011"), "Windows 10");
assert.equal(windowsMarketingName("6.1.7601"), null);
assert.equal(windowsMarketingName(""), null);
assert.equal(windowsMarketingName("10.0"), null);
});
test("shows Windows marketing name while keeping the raw build for diagnostics", () => {
assert.equal(
formatSupportInfoOperatingSystem({ appVersion: "0.6.22", runtime: "desktop", osName: "Windows", osVersion: "10.0.26200.9457", arch: "x86_64" }, labels.unknown),
"Windows 11 (10.0.26200.9457)",
);
assert.equal(
formatSupportInfoOperatingSystem({ appVersion: "0.6.22", runtime: "desktop", osName: "Windows", osVersion: "10.0.19045.5011", arch: "x64" }, labels.unknown),
"Windows 10 (10.0.19045.5011)",
);
});
test("leaves non-10.0 Windows and other platforms unchanged", () => {
assert.equal(
formatSupportInfoOperatingSystem({ appVersion: "x", runtime: "desktop", osName: "Windows", osVersion: "6.1.7601", arch: "x86" }, labels.unknown),
"Windows 6.1.7601",
);
assert.equal(
formatSupportInfoOperatingSystem({ appVersion: "x", runtime: "desktop", osName: "macOS", osVersion: "15.5", arch: "aarch64" }, labels.unknown),
"macOS 15.5",
);
});