From 78ad8e3c31cc5239674dfd7ca6159e5ca14da0e8 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sat, 10 May 2025 12:10:47 -0500 Subject: [PATCH] tests/mako: add a deprecation test Make sure old criteria still works --- tests/modules/services/mako/default.nix | 5 +- .../services/mako/deprecated-criteria.nix | 65 +++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 tests/modules/services/mako/deprecated-criteria.nix diff --git a/tests/modules/services/mako/default.nix b/tests/modules/services/mako/default.nix index b839429b..3c4ed3bf 100644 --- a/tests/modules/services/mako/default.nix +++ b/tests/modules/services/mako/default.nix @@ -1 +1,4 @@ -{ mako-example-config = ./example-config.nix; } +{ + mako-example-config = ./example-config.nix; + mako-deprecated-criteria = ./deprecated-criteria.nix; +} diff --git a/tests/modules/services/mako/deprecated-criteria.nix b/tests/modules/services/mako/deprecated-criteria.nix new file mode 100644 index 00000000..57d57d4d --- /dev/null +++ b/tests/modules/services/mako/deprecated-criteria.nix @@ -0,0 +1,65 @@ +{ + services.mako = { + enable = true; + # Global settings + settings = { + actions = true; + anchor = "top-right"; + background-color = "#000000"; + border-color = "#FFFFFF"; + border-radius = 0; + default-timeout = 0; + font = "monospace 10"; + height = 100; + width = 300; + icons = true; + ignore-timeout = false; + layer = "top"; + margin = 10; + markup = true; + }; + + # Using deprecated criteria option + criteria = { + "actionable=true" = { + anchor = "top-left"; + }; + "app-name=Google\\ Chrome" = { + max-visible = 5; + }; + "field1=value field2=value" = { + text-alignment = "left"; + }; + }; + }; + + test.asserts.warnings.expected = [ + '' + The option `services.mako.criteria` is deprecated and will be removed in a future release. + Please use `services.mako.settings` with nested attributes instead. + + For example, instead of: + criteria = { + "actionable=true" = { + anchor = "top-left"; + }; + }; + + Use: + settings = { + # Global settings here... + + # Criteria sections + "actionable=true" = { + anchor = "top-left"; + }; + }; + '' + ]; + + nmt.script = '' + assertFileExists home-files/.config/mako/config + assertFileContent home-files/.config/mako/config \ + ${./config} + ''; +}