mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
test: copy over most tests, add new tests for soonix
This commit is contained in:
parent
0bd75fd1bb
commit
436e2fde25
7 changed files with 439 additions and 9 deletions
68
tests/helpers_test.nix
Normal file
68
tests/helpers_test.nix
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
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";
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue