Fediversity/website/tests.nix

43 lines
859 B
Nix
Raw Normal View History

2024-11-27 11:21:59 +01:00
# tests written for running with `nix-unit`
# https://github.com/nix-community/nix-unit
let
inherit (import ./. { }) lib;
in
{
2025-02-19 18:34:19 +01:00
test-relativePath =
with lib;
2024-11-27 12:51:38 +01:00
let
testData = [
2025-02-19 18:34:19 +01:00
{
from = "bar";
to = "baz";
expected = "./baz";
}
{
from = "foo/bar";
to = "foo/baz";
expected = "./baz";
}
{
from = "foo";
to = "bar/baz";
expected = "./bar/baz";
}
{
from = "foo/bar";
to = "baz";
expected = "./../baz";
}
{
from = "foo/bar/baz";
to = "foo";
expected = "./../../foo";
}
2024-11-27 12:51:38 +01:00
];
in
{
expr = map (case: relativePath case.from case.to) testData;
expected = map (case: case.expected) testData;
};
2024-11-27 11:21:59 +01:00
}