The repeat rules are pinned by the shared fixture
daily/weekly/monthly/yearly was written out in the server (REMINDER_RECURRENCES), the core (recur::RECURRENCES), the web editor's <option>s and Android's picker, with nothing holding them together. grammar.json now has a recurrences list; the server, core and web suites each check theirs against it, and the web's options come from notes/recurrence.ts rather than the template. Android's picker pins the list by hand with its localised labels, as it does the tint: its JVM tests do not read the fixture. DRY pass #2, batch 3 (#5372). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import { describe, expect, it } from "vitest";
|
||||
import fixture from "../../../core/testdata/grammar.json";
|
||||
import { DERIVED_TINT_KEYS, derivedTint, resolveLabelColor, tintHash } from "./colors";
|
||||
import { parseInline, parseTaskLine, renderTaskLine } from "./markdown";
|
||||
import { RECURRENCES } from "./recurrence";
|
||||
|
||||
describe("checklist lines", () => {
|
||||
it.each(fixture.task_lines)("$line", ({ line, item }) => {
|
||||
@@ -52,3 +53,9 @@ describe("derived tag colour", () => {
|
||||
expect(resolveLabelColor({ name })).toBe(color);
|
||||
});
|
||||
});
|
||||
|
||||
describe("recurrences", () => {
|
||||
it("offers the stored rules every surface holds", () => {
|
||||
expect(RECURRENCES.map((r) => r.value)).toEqual(fixture.recurrences);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// The repeat rules a reminder can carry, as stored, and what the editor calls each.
|
||||
// The server (REMINDER_RECURRENCES) and the core (recur::RECURRENCES) hold the same
|
||||
// list, and all three run the `recurrences` case in core/testdata/grammar.json.
|
||||
export const RECURRENCES: ReadonlyArray<{ value: string; label: string }> = [
|
||||
{ value: "daily", label: "Daily" },
|
||||
{ value: "weekly", label: "Weekly" },
|
||||
{ value: "monthly", label: "Monthly" },
|
||||
{ value: "yearly", label: "Yearly" },
|
||||
];
|
||||
Reference in New Issue
Block a user