wrapper-manager-fds/tests: update test structure for configs

This commit is contained in:
Gabriel Arazas 2024-09-21 19:32:08 +08:00
parent b667a335de
commit 19a035da58
7 changed files with 26 additions and 15 deletions

View File

@ -45,6 +45,7 @@
system:
let
pkgs = import sources.nixos-unstable { inherit system; };
inherit (pkgs) lib;
tests = import ./tests { inherit pkgs; };
docs = import ./docs { inherit pkgs; };
in
@ -60,7 +61,9 @@
website = docs.website;
};
checks.wrapperManagerLibrarySetPkg = tests.libTestPkg;
checks =
{ inherit (tests) lib; }
// lib.mapAttrs' (n: v: lib.nameValuePair "config-test-${n}" v) tests.configs;
}
));
}

View File

@ -7,11 +7,14 @@ in
let
wmLib = (import ../../. { }).lib;
build = modules: wmLib.build { inherit pkgs modules; };
build = args: wmLib.build (args // { inherit pkgs; });
in
{
fastfetch = build [ ./wrapper-fastfetch.nix ];
neofetch = build [ ./wrapper-neofetch.nix ];
single-basepackage = build [ ./single-basepackage.nix ];
neofetch-with-additional-files = build [ ./neofetch-with-additional-files.nix ];
fastfetch = build { modules = [ ./wrapper-fastfetch.nix ]; };
neofetch = build {
modules = [ ./wrapper-neofetch.nix ];
specialArgs.yourMomName = "Yor mom";
};
single-basepackage = build { modules = [ ./single-basepackage.nix ]; };
neofetch-with-additional-files = build { modules = [ ./neofetch-with-additional-files.nix ]; };
}

View File

@ -37,7 +37,7 @@
WHAT
'';
build.extraPassthru.tests = {
build.extraPassthru.wrapperManagerTests = {
actuallyBuilt =
let
wrapper = config.build.toplevel;

View File

@ -13,7 +13,7 @@
xdg.desktopEntry.enable = true;
};
build.extraPassthru.tests = {
build.extraPassthru.wrapperManagerTests = {
singleBasePackage =
let
wrapper = config.build.toplevel;

View File

@ -23,7 +23,7 @@
hello
]);
build.extraPassthru.tests = {
build.extraPassthru.wrapperManagerTests = {
actuallyBuilt =
let
wrapper = config.build.toplevel;

View File

@ -20,7 +20,7 @@
];
};
build.extraPassthru.tests = {
build.extraPassthru.wrapperManagerTests = {
actuallyBuilt =
let
wrapper = config.build.toplevel;

View File

@ -6,14 +6,20 @@ in
}:
let
lib = import ./lib { inherit pkgs; };
wrapperManagerLibTests = import ./lib { inherit pkgs; };
inherit (pkgs) lib;
in
{
inherit lib;
libTestPkg =
configs = let
configs' = import ./configs { inherit pkgs; };
updateTestName = configName: package: lib.mapAttrs' (n: v: lib.nameValuePair "${configName}-${n}" v) package.wrapperManagerTests;
in
lib.concatMapAttrs updateTestName configs';
lib =
pkgs.runCommand "wrapper-manager-fds-lib-test"
{
testData = builtins.toJSON lib;
testData = builtins.toJSON wrapperManagerLibTests;
passAsFile = [ "testData" ];
nativeBuildInputs = with pkgs; [
yajsv
@ -23,5 +29,4 @@ in
''
yajsv -s "${./lib/tests.schema.json}" "$testDataPath" && touch $out || jq . "$testDataPath"
'';
configs = import ./configs { inherit pkgs; };
}