mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
68 lines
1.7 KiB
Nix
68 lines
1.7 KiB
Nix
{
|
|
pkgs,
|
|
cilib,
|
|
...
|
|
}: {
|
|
suites."Helpers" = {
|
|
pos = __curPos;
|
|
tests = let
|
|
inherit (cilib) helpers;
|
|
in [
|
|
{
|
|
name = "appendToAfterScript";
|
|
expected = {
|
|
after_script = ["echo after_script" "finalize_nix_ci"];
|
|
};
|
|
actual = helpers.appendToAfterScript ["finalize_nix_ci"] {
|
|
after_script = ["echo after_script"];
|
|
};
|
|
}
|
|
{
|
|
name = "prependToBeforeScript";
|
|
expected = {
|
|
before_script = ["setup_nix_ci" "echo before_script"];
|
|
};
|
|
actual = helpers.prependToBeforeScript ["setup_nix_ci"] {
|
|
before_script = ["echo before_script"];
|
|
};
|
|
}
|
|
{
|
|
name = "toYaml";
|
|
expected = ''{"hello":"world"}'';
|
|
actual = builtins.readFile (helpers.toYaml "test" {hello = "world";});
|
|
}
|
|
{
|
|
name = "filterAttrsRec";
|
|
expected = {world = "world";};
|
|
actual = helpers.filterAttrsRec (_n: v: v != null) {
|
|
hello = null;
|
|
world = "world";
|
|
};
|
|
}
|
|
{
|
|
name = "filterJobVariables with store paths";
|
|
expected = {
|
|
HELLO = "${pkgs.hello}";
|
|
MULTIPLE = "${pkgs.hello}:${pkgs.hello}";
|
|
};
|
|
actual = helpers.filterJobVariables true {
|
|
variables = {
|
|
HELLO = "${pkgs.hello}";
|
|
WORLD = "world";
|
|
MULTIPLE = "${pkgs.hello}:${pkgs.hello}";
|
|
};
|
|
};
|
|
}
|
|
{
|
|
name = "filterJobVariables without store paths";
|
|
expected = {WORLD = "world";};
|
|
actual = helpers.filterJobVariables false {
|
|
variables = {
|
|
HELLO = "${pkgs.hello}";
|
|
WORLD = "world";
|
|
};
|
|
};
|
|
}
|
|
];
|
|
};
|
|
}
|