mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-12 01:59:37 +08:00
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 <khaneliman12@gmail.com>
This commit is contained in:
committed by
Austin Horstman
parent
7c01358ff6
commit
fa184c5460
@@ -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;
|
||||
}
|
||||
|
||||
58
tests/modules/services/hyprsunset/transitions-deprecated.nix
Normal file
58
tests/modules/services/hyprsunset/transitions-deprecated.nix
Normal file
@@ -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.
|
||||
''
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user