jjui: test configuration discovery and directory overrides

Cover session-variable omission for automatic paths and preservation for
custom paths and Darwin Lua-only configurations.
This commit is contained in:
Austin Horstman
2026-09-21 08:40:39 -05:00
parent 2f6e5aac8d
commit a5768f1a46
9 changed files with 120 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
{
programs.jjui = {
enable = true;
configDir = "/home/hm-user/custom-jjui";
configLua = "function setup(config) end";
};
nmt.script = ''
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
'export JJUI_CONFIG_DIR="/home/hm-user/custom-jjui"'
assertFileContent home-files/custom-jjui/config.lua \
${builtins.toFile "jjui-config.lua" "function setup(config) end"}
assertPathNotExists home-files/custom-jjui/config.toml
'';
}

View File

@@ -1,5 +1,10 @@
{
jjui-custom-config-dir = ./custom-config-dir.nix;
jjui-empty-settings = ./empty-settings.nix;
jjui-example-settings = ./example-settings.nix;
jjui-lua-only = ./lua-only.nix;
jjui-null-package = ./null-package.nix;
jjui-plugins-only = ./plugins-only.nix;
jjui-xdg-disabled = ./xdg-disabled.nix;
jjui-xdg-enabled = ./xdg-enabled.nix;
}

View File

@@ -1,9 +1,12 @@
{
config = {
programs.jjui.enable = true;
xdg.enable = false;
nmt.script = ''
assertPathNotExists home-files/.config/jjui
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh \
'^export JJUI_CONFIG_DIR='
'';
};
}

View File

@@ -49,6 +49,9 @@
configDir = ".config/jjui";
in
''
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh \
'^export JJUI_CONFIG_DIR='
assertFileContent \
"home-files/${configDir}/config.toml" \
${./example-settings-expected.toml}

View File

@@ -0,0 +1,21 @@
{ lib, pkgs, ... }:
{
programs.jjui = {
enable = true;
configLua = "function setup(config) end";
};
nmt.script = ''
assertFileExists home-files/.config/jjui/config.lua
assertPathNotExists home-files/.config/jjui/config.toml
''
+ lib.optionalString pkgs.stdenv.hostPlatform.isLinux ''
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh \
'^export JJUI_CONFIG_DIR='
''
+ lib.optionalString pkgs.stdenv.hostPlatform.isDarwin ''
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
'export JJUI_CONFIG_DIR="/home/hm-user/.config/jjui"'
'';
}

View File

@@ -18,6 +18,9 @@
configDir = ".config/jjui";
in
''
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh \
'^export JJUI_CONFIG_DIR='
assertFileContent \
"home-files/${configDir}/config.toml" \
${pkgs.writeText "expected" ''

View File

@@ -0,0 +1,22 @@
{ lib, pkgs, ... }:
{
programs.jjui = {
enable = true;
plugins.foo = ./foo.lua;
};
nmt.script = ''
assertFileContent home-files/.config/jjui/plugins/foo.lua ${./foo.lua}
assertPathNotExists home-files/.config/jjui/config.lua
assertPathNotExists home-files/.config/jjui/config.toml
''
+ lib.optionalString pkgs.stdenv.hostPlatform.isLinux ''
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh \
'^export JJUI_CONFIG_DIR='
''
+ lib.optionalString pkgs.stdenv.hostPlatform.isDarwin ''
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
'export JJUI_CONFIG_DIR="/home/hm-user/.config/jjui"'
'';
}

View File

@@ -0,0 +1,20 @@
{
programs.jjui = {
enable = true;
configLua = "function setup(config) end";
};
xdg = {
enable = false;
configHome = "/home/hm-user/custom-xdg";
};
nmt.script = ''
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh \
'^export XDG_CONFIG_HOME='
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
'export JJUI_CONFIG_DIR="/home/hm-user/custom-xdg/jjui"'
assertFileExists home-files/custom-xdg/jjui/config.lua
assertPathNotExists home-files/custom-xdg/jjui/config.toml
'';
}

View File

@@ -0,0 +1,28 @@
{ lib, pkgs, ... }:
{
programs.jjui = {
enable = true;
configLua = "function setup(config) end";
};
xdg = {
enable = true;
configHome = "/home/hm-user/custom-xdg";
};
nmt.script = ''
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
'export XDG_CONFIG_HOME="/home/hm-user/custom-xdg"'
assertFileExists home-files/custom-xdg/jjui/config.lua
assertPathNotExists home-files/custom-xdg/jjui/config.toml
''
+ lib.optionalString pkgs.stdenv.hostPlatform.isLinux ''
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh \
'^export JJUI_CONFIG_DIR='
''
+ lib.optionalString pkgs.stdenv.hostPlatform.isDarwin ''
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
'export JJUI_CONFIG_DIR="/home/hm-user/custom-xdg/jjui"'
'';
}