tests/mako: add a deprecation test

Make sure old criteria still works
This commit is contained in:
Austin Horstman 2025-05-10 12:10:47 -05:00
parent 0be2c246e3
commit 78ad8e3c31
2 changed files with 69 additions and 1 deletions

View file

@ -1 +1,4 @@
{ mako-example-config = ./example-config.nix; }
{
mako-example-config = ./example-config.nix;
mako-deprecated-criteria = ./deprecated-criteria.nix;
}

View file

@ -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}
'';
}