From 3325dcb00b05c3514b6e15260e210b0bc8b363d2 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sat, 31 Aug 2024 09:11:13 -0500 Subject: [PATCH] plugins/gitgutter: add tests --- tests/test-sources/plugins/git/gitgutter.nix | 41 ++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/test-sources/plugins/git/gitgutter.nix diff --git a/tests/test-sources/plugins/git/gitgutter.nix b/tests/test-sources/plugins/git/gitgutter.nix new file mode 100644 index 00000000..52d42d99 --- /dev/null +++ b/tests/test-sources/plugins/git/gitgutter.nix @@ -0,0 +1,41 @@ +{ lib, pkgs, ... }: +{ + empty = { + plugins.gitgutter.enable = true; + }; + + grep-command = + { config, ... }: + { + plugins.gitgutter = { + enable = true; + grep = { + package = pkgs.gnugrep; + command = ""; + }; + }; + assertions = [ + { + assertion = + config.extraPackages != [ ] && lib.any (x: x.pname or null == "gnugrep") config.extraPackages; + message = "gnugrep wasn't found when it was expected"; + } + ]; + }; + + no-packages = + { config, ... }: + { + globals.gitgutter_git_executable = lib.getExe pkgs.git; + plugins.gitgutter = { + enable = true; + gitPackage = null; + }; + assertions = [ + { + assertion = lib.all (x: x.pname or null != "git") config.extraPackages; + message = "A git package found in extraPackages when it wasn't expected"; + } + ]; + }; +}