[OCaml] High Intensity Training Online
test cover Home state after cancellation
Assert that a cancelled workout removes the in-progress card from Home, completing the regression coverage for the native cancellation redirect.
test/test_web.ml
@@ -914,21 +914,17 @@
914
914
let _ =
915
915
post c "/workout" [ ("dream.csrf", token); ("override", "false") ]
916
916
in
917
Removed:
(* While logging, the middle tab reads Current workout. *)
918
Removed:
let logging_page = body (get c "/workout") in
919
Removed:
Alcotest.(check bool)
920
Removed:
"middle tab reads Current workout while logging" true
921
Removed:
(contains ~substring:"Current workout" logging_page);
922
Removed:
(* Cancel, then land on the routine tab. *)
923
917
let token = Option.get (csrf_token (body (get c "/workout"))) in
924
Removed:
let _ = post c "/workout/cancel" [ ("dream.csrf", token) ] in
925
Removed:
let routine_page = body (get c "/routine") in
918
Added:
let cancelled =
919
Added:
post c "/workout/cancel" [ ("dream.csrf", token) ]
920
Added:
in
926
921
Alcotest.(check bool)
927
Removed:
"middle tab reverts to Routine after cancellation" true
928
Removed:
(contains ~substring:">Routine<" routine_page);
922
Added:
"cancel redirects to Home" true
923
Added:
(List.mem "/" (Dream.headers cancelled "Location"));
924
Added:
let home_page = body (get c "/") in
929
925
Alcotest.(check bool)
930
Removed:
"middle tab no longer reads Current workout" false
931
Removed:
(contains ~substring:"Current workout" routine_page) );
926
Added:
"Home has no current workout card" false
927
Added:
(contains ~substring:"Workout in progress" home_page) );
932
928
( "the saved logbook view does not offer a cancel control",
933
929
`Quick,
934
930
fun () ->