From c74238e1054e45811fdf28a61cd7a6533f612010 Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Thu, 8 Jan 2026 22:22:47 +0100 Subject: [PATCH] Add a test for the initial state of the remote-controlled lights --- NightLight.Core.Tests/NightLightTests.fs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/NightLight.Core.Tests/NightLightTests.fs b/NightLight.Core.Tests/NightLightTests.fs index 935f4c6..35ec4cf 100644 --- a/NightLight.Core.Tests/NightLightTests.fs +++ b/NightLight.Core.Tests/NightLightTests.fs @@ -71,6 +71,21 @@ type NightLightTests() = doesLightHavePowerAfter light interactions = fakeHome.LightShouldHaveState light _.IsOn + [ |])>] + 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 + [ |])>] 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)