Re-write tests without ==>

This commit is contained in:
Sven van Heugten 2026-01-09 19:23:19 +01:00
parent cefe696f97
commit b53151b4c5
2 changed files with 27 additions and 31 deletions

View file

@ -33,3 +33,21 @@ let ensureStartsWithTimeChanged (genInteractions: Gen<Interaction list>) =
match interactions with
| Interaction.TimeChanged _ :: _ -> Gen.constant interactions
| _ -> genTimeChanged |> Gen.map (fun tc -> tc :: interactions))
let ensureLightHasPower (light: Light) (genInteractions: Gen<Interaction list>) =
genInteractions
|> Gen.map (fun interactions ->
let lightHasPower =
interactions
|> Seq.choose (fun interaction ->
match interaction with
| HumanInteraction(LightPoweredOff l) when l = light -> Some false
| HumanInteraction(LightPoweredOn l) when l = light -> Some true
| _ -> None)
|> Seq.tryLast
|> Option.defaultValue false
if lightHasPower then
interactions
else
interactions @ [ HumanInteraction(LightPoweredOn light) ])