The code cited its plan instead of saying why: `E28 review J4`, `(R6 S3b)`, `S1 justified…`,
`deep-review round 5`. That plan lives in the private ops repo, so for every reader of this one the
citation was noise, and a sentence whose subject was the plan step ("round 2 showed…") hid its
lesson behind an id. Each one is gone and the "why" kept: a bare citation is deleted, a sentence
carrying a lesson is reworded around it ("a later attempt showed…").
Measured (`scripts/audit_metrics.py`, product code): 652 lines in 270 files carried an epic code by
the definition the next commit holds (507 / 241 by the old, two-digit-only one) -> 0. Across all
code, tests, scripts and configs: ~1100 epic-code lines plus ~320 sprint/round ids.
Behaviour unchanged, checked mechanically: every changed .py file has the same AST once docstrings
are blanked; css/sh/toml/yml/json files are identical once comments are stripped; the only
non-comment changes in TS/JS are test titles, one description string in a contract table, and five
ESLint messages, whose text is all the gates snapshot diff holds. Not touched: Markdown (docs and
the changelog keep their history), Alembic migrations, TV episode notation (`S2 · E5`), DESIGN.md
ids (`C1`, `B4`, `S3h`), tracker ids (`SEC-16`, `DX-17`).
One stale claim fixed on the way: test_hls_reaper's docstring said the player checkpoints "every
10 s whether or not it is playing", which plex/stream.py calls wrong; it now says what the code does.
125 lines
4.8 KiB
TypeScript
125 lines
4.8 KiB
TypeScript
// @vitest-environment jsdom
|
|
//
|
|
// The server's closed English vocabularies, named in the reader's language — through the REAL
|
|
// catalog, so a missing or misnamed key shows here as the English word coming through.
|
|
import { describe, expect, it } from "vitest";
|
|
import i18n from "../i18n";
|
|
import { languageName, profileName, regionName, trackLabel, vocab } from "./vocab";
|
|
|
|
const hu = i18n.getFixedT("hu");
|
|
const en = i18n.getFixedT("en");
|
|
|
|
describe("a vocabulary word", () => {
|
|
it.each([
|
|
["crewJob", "Director of Photography", "Operatőr"],
|
|
["crewJob", "Executive Producer", "Vezető producer"],
|
|
["department", "Acting", "Színészet"],
|
|
["autoTag", "Health & Fitness", "Egészség és fitnesz"],
|
|
["autoTag", "Hungarian", "Magyar"],
|
|
["profile", "Video only (MP4)", "Csak videó (MP4)"],
|
|
["topic", "Lifestyle_(sociology)", "Életmód"],
|
|
// Plex's certificate words came through in English on the info badge and the filter.
|
|
["certificate", "Not Rated", "Nincs besorolva"],
|
|
["certificate", "Approved", "Jóváhagyva"],
|
|
["certificate", "Passed", "Engedélyezve"],
|
|
] as const)("%s %j reads %j in Hungarian", (group, word, shown) => {
|
|
expect(vocab(hu, group, word)).toBe(shown);
|
|
});
|
|
|
|
it("the English reader sees the word as it was", () => {
|
|
expect(vocab(en, "crewJob", "Director of Photography")).toBe("Director of Photography");
|
|
expect(vocab(en, "topic", "Pop_music", "Pop music")).toBe("Pop music");
|
|
});
|
|
|
|
it("a certificate code reads the same in every language", () => {
|
|
expect(vocab(hu, "certificate", "PG-13")).toBe("PG-13");
|
|
expect(vocab(hu, "certificate", "TV-MA")).toBe("TV-MA");
|
|
});
|
|
|
|
it("an unknown word is shown, not hidden or keyed", () => {
|
|
expect(vocab(hu, "crewJob", "Gaffer")).toBe("Gaffer");
|
|
expect(vocab(hu, "topic", "Knitting_(craft)", "Knitting (craft)")).toBe("Knitting (craft)");
|
|
});
|
|
});
|
|
|
|
describe("a country", () => {
|
|
it("is named from its code in the reader's language", () => {
|
|
expect(regionName(hu, "US", "hu", "United States of America")).toBe("Egyesült Államok");
|
|
expect(regionName(en, "DE", "en", "Germany")).toBe("Germany");
|
|
});
|
|
|
|
it("that no longer exists keeps its own name — Intl would call Yugoslavia Serbia", () => {
|
|
expect(regionName(hu, "YU", "hu", "Yugoslavia")).toBe("Jugoszlávia");
|
|
expect(regionName(hu, "SU", "hu", "Soviet Union")).toBe("Szovjetunió");
|
|
expect(regionName(en, "XI", "en", "Northern Ireland")).toBe("Northern Ireland");
|
|
});
|
|
|
|
it("without a code shows the stored name", () => {
|
|
expect(regionName(hu, null, "hu", "Hungary")).toBe("Hungary");
|
|
});
|
|
});
|
|
|
|
describe("a language", () => {
|
|
it("stands alone capitalized, region kept", () => {
|
|
expect(languageName("hu", "hu")).toBe("Magyar");
|
|
expect(languageName("en-US", "en")).toBe("American English");
|
|
});
|
|
|
|
it("falls back to what was given for a tag Intl cannot name", () => {
|
|
expect(languageName("qqq", "hu", "Klingon")).toBe("Klingon");
|
|
expect(languageName("und", "hu", "Unknown")).toBe("Unknown"); // "undetermined": no language
|
|
});
|
|
});
|
|
|
|
describe("a player track", () => {
|
|
const track = { ord: 0, label: "English (AC3 5.1)", lang_tag: "en-US", detail: "AC3 5.1" };
|
|
|
|
it("is named from its language, not Plex's server-language title", () => {
|
|
expect(trackLabel(hu, track, "audio", "hu")).toBe("Angol (AC3 5.1)");
|
|
expect(trackLabel(en, track, "audio", "en")).toBe("English (AC3 5.1)");
|
|
});
|
|
|
|
it("says forced / SDH and translates the channel word", () => {
|
|
expect(
|
|
trackLabel(
|
|
hu,
|
|
{ ord: 1, label: "magyar Forced", lang_tag: "hu", forced: true },
|
|
"subtitle",
|
|
"hu",
|
|
),
|
|
).toBe("Magyar, kényszerített");
|
|
expect(
|
|
trackLabel(
|
|
hu,
|
|
{ ord: 2, label: "中文", lang_tag: "zh", detail: "EAC3 Stereo" },
|
|
"audio",
|
|
"hu",
|
|
),
|
|
).toBe("Kínai (EAC3 sztereó)");
|
|
expect(
|
|
trackLabel(
|
|
en,
|
|
{ ord: 3, label: "English SDH", lang_tag: "en", hearing_impaired: true },
|
|
"subtitle",
|
|
"en",
|
|
),
|
|
).toBe("English, SDH");
|
|
});
|
|
|
|
it("with no language keeps Plex's title, and with nothing is numbered", () => {
|
|
expect(trackLabel(hu, { ord: 0, label: "Commentary" }, "audio", "hu")).toBe("Commentary");
|
|
expect(trackLabel(hu, { ord: 2, label: null, lang_tag: "und" }, "audio", "hu")).toBe(
|
|
"3. hangsáv",
|
|
);
|
|
expect(trackLabel(hu, { ord: 1, label: null }, "subtitle", "hu")).toBe("2. felirat");
|
|
expect(trackLabel(en, { ord: 0, label: null }, "audio", "en")).toBe("Audio 1");
|
|
});
|
|
});
|
|
|
|
describe("a download profile", () => {
|
|
it("built in, is named in the reader's language; the user's own stays as typed", () => {
|
|
expect(profileName(hu, { name: "Audio (MP3)", is_builtin: true })).toBe("Hang (MP3)");
|
|
expect(profileName(hu, { name: "Audio (MP3)", is_builtin: false })).toBe("Audio (MP3)");
|
|
});
|
|
});
|