Files
DeepTutor/web/tests/version.test.ts
Bingxi Zhao (Frank) a4fa63b6e2 feat(desktop): add Open DeepTutor for macOS under apps/desktop
Move the Electron macOS app into the main repository and ship it with every
DeepTutor release.

- apps/desktop: Electron shell that installs a signed bundled runtime and
  hosts the web UI; versioned with the bundled core.
- White app icon with the black DeepTutor mark, generated by
  scripts/make-icon.swift; redesigned start screen and title bar.
- Shell copy in en/zh/de/fr/pl/uk, starting in English and following the
  interface language and theme from DeepTutor Settings, including live changes.
- Web UI labels itself "Open DeepTutor MacOS v<version>" inside the app
  (user-agent marker) and "Open DeepTutor Web v<version>" in a browser.
- Sealing refuses a missing or mismatched signing key instead of silently
  generating a new one.
- desktop-release.yml builds, smoke-tests and attaches the DMG to each
  GitHub Release; Developer ID signing and notarization run when secrets exist.
- tests.yml runs the shell checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 19:20:15 +08:00

45 lines
1.4 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import { clientEditionLabel, normalizeVersionTag } from "../lib/version";
test("normalizeVersionTag accepts bare semver", () => {
assert.equal(normalizeVersionTag("1.4.0"), "v1.4.0");
});
test("normalizeVersionTag keeps the v prefix", () => {
assert.equal(normalizeVersionTag("v1.4.0"), "v1.4.0");
});
test("normalizeVersionTag supports PEP 440-style pre-releases", () => {
assert.equal(normalizeVersionTag("v1.0.0-beta.4"), "v1.0.0-beta.4");
assert.equal(normalizeVersionTag("1.0.0rc1"), "v1.0.0rc1");
});
test("normalizeVersionTag rejects unparseable inputs", () => {
assert.equal(normalizeVersionTag(""), null);
assert.equal(normalizeVersionTag(undefined), null);
assert.equal(normalizeVersionTag("abc1234"), null);
assert.equal(normalizeVersionTag("v1.2.3-5-gabc1234"), null);
});
test("clientEditionLabel names the web client by default", () => {
assert.equal(
clientEditionLabel("1.7.0", "Mozilla/5.0 Chrome/140.0"),
"Open DeepTutor Web v1.7.0",
);
});
test("clientEditionLabel recognises the macOS desktop shell", () => {
assert.equal(
clientEditionLabel(
"1.7.0",
"Mozilla/5.0 Chrome/140.0 Electron/45.1.0 OpenDeepTutor/1.7.0 (macOS)",
),
"Open DeepTutor MacOS v1.7.0",
);
});
test("clientEditionLabel omits an unparseable version", () => {
assert.equal(clientEditionLabel(undefined, ""), "Open DeepTutor Web");
});