summaryrefslogtreecommitdiff
path: root/test/test_view.ml
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_view.ml')
-rw-r--r--test/test_view.ml19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_view.ml b/test/test_view.ml
index e8de6a0..24e1d85 100644
--- a/test/test_view.ml
+++ b/test/test_view.ml
@@ -94,6 +94,24 @@ let test_weeks_flatten_to_days () =
own real)
(as_list (get [ "months" ] v))
+(* Defect 2 (the continuous ordo booklet): [first] is true on exactly one
+ week per month -- the first -- so a template can print a strong,
+ standalone month banner at that point instead of every week's own header
+ looking identical. *)
+let test_first_week_flag () =
+ let v = view_of 2027 in
+ List.iter
+ (fun m ->
+ let weeks = as_list (get [ "weeks" ] m) in
+ match weeks with
+ | [] -> Alcotest.fail "a month with no weeks at all"
+ | first :: rest ->
+ Alcotest.(check bool) "first week flagged" true (as_bool (get [ "first" ] first));
+ List.iter
+ (fun w -> Alcotest.(check bool) "later week not flagged" false (as_bool (get [ "first" ] w)))
+ rest)
+ (as_list (get [ "months" ] v))
+
let test_padding_cells_are_flagged () =
let v = view_of 2027 in
let jan = List.hd (as_list (get [ "months" ] v)) in
@@ -207,6 +225,7 @@ let suite =
[ Alcotest.test_case "year shape" `Quick test_year_shape;
Alcotest.test_case "weeks flatten to days" `Quick test_weeks_flatten_to_days;
Alcotest.test_case "padding cells flagged" `Quick test_padding_cells_are_flagged;
+ Alcotest.test_case "first week flagged" `Quick test_first_week_flag;
Alcotest.test_case "padding and real days share key set" `Quick test_padding_and_real_share_key_set;
Alcotest.test_case "no day shows a slug" `Quick test_no_day_shows_a_slug;
Alcotest.test_case "slug unchanged by naming" `Quick test_slug_is_unchanged_by_naming;