mirror of
https://github.com/nix-community/home-manager.git
synced 2026-10-02 19:49:18 +00:00
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:
15
tests/modules/programs/jjui/custom-config-dir.nix
Normal file
15
tests/modules/programs/jjui/custom-config-dir.nix
Normal 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
|
||||
'';
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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='
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
|
||||
21
tests/modules/programs/jjui/lua-only.nix
Normal file
21
tests/modules/programs/jjui/lua-only.nix
Normal 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"'
|
||||
'';
|
||||
}
|
||||
@@ -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" ''
|
||||
|
||||
22
tests/modules/programs/jjui/plugins-only.nix
Normal file
22
tests/modules/programs/jjui/plugins-only.nix
Normal 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"'
|
||||
'';
|
||||
}
|
||||
20
tests/modules/programs/jjui/xdg-disabled.nix
Normal file
20
tests/modules/programs/jjui/xdg-disabled.nix
Normal 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
|
||||
'';
|
||||
}
|
||||
28
tests/modules/programs/jjui/xdg-enabled.nix
Normal file
28
tests/modules/programs/jjui/xdg-enabled.nix
Normal 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"'
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user