From fa184c5460b1099ad7dafeba0ae980a998a12d8d Mon Sep 17 00:00:00 2001 From: kerfuzzle <58907164+kerfuzzle@users.noreply.github.com> Date: Tue, 29 Jul 2025 10:51:11 +0100 Subject: [PATCH] hyprsunset: Add tests for transitons option Adds tests to ensure that the services are still created correctly and the correct deprecation warnings are shown Signed-off-by: Austin Horstman --- tests/modules/services/hyprsunset/default.nix | 1 + .../hyprsunset/transitions-deprecated.nix | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 tests/modules/services/hyprsunset/transitions-deprecated.nix diff --git a/tests/modules/services/hyprsunset/default.nix b/tests/modules/services/hyprsunset/default.nix index a416782d..3ed202c9 100644 --- a/tests/modules/services/hyprsunset/default.nix +++ b/tests/modules/services/hyprsunset/default.nix @@ -3,4 +3,5 @@ lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux { hyprsunset-basic-configuration = ./basic-configuration.nix; hyprsunset-no-configuration = ./no-configuration.nix; + hyprsunset-transitions-deprecated = ./transitions-deprecated.nix; } diff --git a/tests/modules/services/hyprsunset/transitions-deprecated.nix b/tests/modules/services/hyprsunset/transitions-deprecated.nix new file mode 100644 index 00000000..0edf30b2 --- /dev/null +++ b/tests/modules/services/hyprsunset/transitions-deprecated.nix @@ -0,0 +1,58 @@ +{ + services.hyprsunset = { + enable = true; + extraArgs = [ "--identity" ]; + + transitions = { + sunrise = { + calendar = "*-*-* 06:30:00"; + requests = [ + [ "temperature 6500" ] + [ "identity" ] + ]; + }; + + sunset = { + calendar = "*-*-* 19:30:00"; + requests = [ [ "temperature 3500" ] ]; + }; + }; + }; + + nmt.script = '' + # Check that the main service exists + mainService=home-files/.config/systemd/user/hyprsunset.service + assertFileExists $mainService + + # Check that the transition services exist + sunriseService=home-files/.config/systemd/user/hyprsunset-sunrise.service + sunsetService=home-files/.config/systemd/user/hyprsunset-sunset.service + assertFileExists $sunriseService + assertFileExists $sunsetService + + # Check that the timers exist + sunriseTimer=home-files/.config/systemd/user/hyprsunset-sunrise.timer + sunsetTimer=home-files/.config/systemd/user/hyprsunset-sunset.timer + assertFileExists $sunriseTimer + assertFileExists $sunsetTimer + + # Verify timer configurations + assertFileContains $sunriseTimer "OnCalendar=*-*-* 06:30:00" + assertFileContains $sunsetTimer "OnCalendar=*-*-* 19:30:00" + + # Verify service configurations + assertFileContains $sunriseService "ExecStart=@hyprland@/bin/hyprctl hyprsunset 'temperature 6500' && @hyprland@/bin/hyprctl hyprsunset identity" + assertFileContains $sunsetService "ExecStart=@hyprland@/bin/hyprctl hyprsunset 'temperature 3500'" + + # Check that the config file does not exist + config=home-files/.config/hypr/hyprsunset.conf + assertPathNotExists $config + ''; + + test.asserts.warnings.expected = [ + '' + Using services.hyprsunset.transitions is deprecated. Please use + services.hyprsunset.settings instead. + '' + ]; +}