diff --git a/tests/modules/programs/jjui/custom-config-dir.nix b/tests/modules/programs/jjui/custom-config-dir.nix new file mode 100644 index 0000000000..c3ef937bf0 --- /dev/null +++ b/tests/modules/programs/jjui/custom-config-dir.nix @@ -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 + ''; +} diff --git a/tests/modules/programs/jjui/default.nix b/tests/modules/programs/jjui/default.nix index faeb7a1579..6d10382cde 100644 --- a/tests/modules/programs/jjui/default.nix +++ b/tests/modules/programs/jjui/default.nix @@ -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; } diff --git a/tests/modules/programs/jjui/empty-settings.nix b/tests/modules/programs/jjui/empty-settings.nix index 0de0946fbc..bed2e6afab 100644 --- a/tests/modules/programs/jjui/empty-settings.nix +++ b/tests/modules/programs/jjui/empty-settings.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=' ''; }; } diff --git a/tests/modules/programs/jjui/example-settings.nix b/tests/modules/programs/jjui/example-settings.nix index bbc1e4a4cd..d835ee4a37 100644 --- a/tests/modules/programs/jjui/example-settings.nix +++ b/tests/modules/programs/jjui/example-settings.nix @@ -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} diff --git a/tests/modules/programs/jjui/lua-only.nix b/tests/modules/programs/jjui/lua-only.nix new file mode 100644 index 0000000000..55fc0805dc --- /dev/null +++ b/tests/modules/programs/jjui/lua-only.nix @@ -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"' + ''; +} diff --git a/tests/modules/programs/jjui/null-package.nix b/tests/modules/programs/jjui/null-package.nix index 5b77be391d..5cd3a60ff1 100644 --- a/tests/modules/programs/jjui/null-package.nix +++ b/tests/modules/programs/jjui/null-package.nix @@ -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" '' diff --git a/tests/modules/programs/jjui/plugins-only.nix b/tests/modules/programs/jjui/plugins-only.nix new file mode 100644 index 0000000000..e9321dbd0d --- /dev/null +++ b/tests/modules/programs/jjui/plugins-only.nix @@ -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"' + ''; +} diff --git a/tests/modules/programs/jjui/xdg-disabled.nix b/tests/modules/programs/jjui/xdg-disabled.nix new file mode 100644 index 0000000000..d76f2fc1d9 --- /dev/null +++ b/tests/modules/programs/jjui/xdg-disabled.nix @@ -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 + ''; +} diff --git a/tests/modules/programs/jjui/xdg-enabled.nix b/tests/modules/programs/jjui/xdg-enabled.nix new file mode 100644 index 0000000000..d73c5ff9d2 --- /dev/null +++ b/tests/modules/programs/jjui/xdg-enabled.nix @@ -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"' + ''; +}