feat(inbox): a run notice from before the result rode along reads its one-liner back into one (E30 S2)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
// one-liner was "recent={'channels_processed': 0, …}, deep={…}" — English keys and a Python repr.
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import i18n, { setLanguage } from "../i18n";
|
||||
import { jobResultText } from "./jobResult";
|
||||
import { jobResultText, parseSummary } from "./jobResult";
|
||||
|
||||
afterEach(() => setLanguage("en"));
|
||||
|
||||
@@ -39,3 +39,24 @@ describe("a job's result", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("an older notice's one-liner", () => {
|
||||
it("reads back into a result when flat", () => {
|
||||
expect(parseSummary("new=403, failed=396, fallback=375")).toEqual({
|
||||
new: 403,
|
||||
failed: 396,
|
||||
fallback: 375,
|
||||
});
|
||||
expect(parseSummary("enriched=0, skipped=tmdb_api_key not set")).toEqual({
|
||||
enriched: 0,
|
||||
skipped: "tmdb_api_key not set",
|
||||
});
|
||||
});
|
||||
|
||||
it("does not when a phase is nested, or it is no summary at all", () => {
|
||||
expect(parseSummary("recent={'channels_processed': 0}, deep={'videos_added': 1}")).toBeNull();
|
||||
expect(parseSummary("sync paused")).toBeNull();
|
||||
expect(parseSummary("42")).toBeNull();
|
||||
expect(parseSummary(null)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user