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:
2026-10-08 14:28:22 -04:00
co-authored by Claude Opus 5.5
parent db9e9a2dfb
commit 4285026cfe
6 changed files with 39 additions and 4 deletions
+13
View File
@@ -74,6 +74,19 @@ mod tests {
use super::*;
use chrono::TimeZone;
#[test]
fn the_rules_are_the_shared_fixtures() {
let fixture: serde_json::Value =
serde_json::from_str(include_str!("../../testdata/grammar.json")).expect("parses");
let want: Vec<&str> = fixture["recurrences"]
.as_array()
.expect("a list")
.iter()
.map(|r| r.as_str().expect("a string"))
.collect();
assert_eq!(RECURRENCES.to_vec(), want);
}
fn utc(y: i32, m: u32, d: u32, h: u32, min: u32) -> DateTime<Utc> {
Utc.with_ymd_and_hms(y, m, d, h, min, 0).unwrap()
}