Add a test for the initial state of the remote-controlled lights

This commit is contained in:
Sven van Heugten 2026-01-08 22:22:47 +01:00
parent 150fa265de
commit c74238e105

View file

@ -71,6 +71,21 @@ type NightLightTests() =
doesLightHavePowerAfter light interactions = fakeHome.LightShouldHaveState light _.IsOn
[<Property(Arbitrary = [| typeof<ArbitraryRemotelyControlledLight> |])>]
let ``All remote controlled lights with power should be on if the 'Off' button on the remote was never pressed``
(light: Light)
=
concatGens
[ genTimeChanged |> Gen.map List.singleton
genInteractionsExcept light ((=) (HumanInteraction RemotePressedOffButton)) ]
|> Arb.fromGen
|> Prop.forAll
<| fun interactions ->
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
doesLightHavePowerAfter light interactions
==> fakeHome.LightShouldHaveState light _.IsOn
[<Property(Arbitrary = [| typeof<ArbitraryRemotelyControlledLight> |])>]
let ``After pressing 'On' on the remote, if the 'Off' button isn't pressed, all remotely controlled lights with power should be on``
(light: Light)