From 84f6b3d1c7a7f2eaddb91414245179190256f7f8 Mon Sep 17 00:00:00 2001 From: Jeff Winn <6961614+jeff-winn@users.noreply.github.com> Date: Sun, 25 Jun 2023 13:48:17 -0400 Subject: [PATCH] Adding unit test. --- .../policies/mowerIsEnabledPolicy.spec.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/services/policies/mowerIsEnabledPolicy.spec.ts b/test/services/policies/mowerIsEnabledPolicy.spec.ts index a7faddd2..04bac45c 100644 --- a/test/services/policies/mowerIsEnabledPolicy.spec.ts +++ b/test/services/policies/mowerIsEnabledPolicy.spec.ts @@ -62,6 +62,23 @@ describe('DeterministicMowerIsScheduledPolicy', () => { expect(target.check()).toBeFalsy(); }); + it('should return true when the mower is scheduled to run but forced to mow', () => { + target.setMowerState({ + activity: Activity.MOWING, + state: State.IN_OPERATION + }); + + target.setMowerSchedule({ + runContinuously: false, + runInFuture: true, + runOnSchedule: true + }); + + const result = target.check(); + + expect(result).toBeTruthy(); + }); + it('should return true when run continuously and in operation', () => { target.setMowerState({ activity: Activity.MOWING,