test: add basic lib function tests for agents and coding-rules

This commit is contained in:
Chiron
2026-04-15 18:43:00 +00:00
parent 41fbe75abc
commit b708b2a05f
3 changed files with 86 additions and 0 deletions

29
tests/lib/agents-test.nix Normal file
View File

@@ -0,0 +1,29 @@
let
lib = import <nixpkgs/lib>;
agentsLib = (import ../../lib {inherit lib;}).agents;
# Test 1: renderForTool throws for unknown tools
testUnknownTool = let
result = builtins.tryEval (
agentsLib.renderForTool {
pkgs = {};
agentsInput = {};
tool = "unknown-tool";
}
);
in
assert result.success == false;
{result = "pass";};
# Test 2: loadCanonical extracts loadAgents from input
testLoadCanonical = let
fakeInput = {lib.loadAgents = {test = {description = "test";};};};
result = agentsLib.loadCanonical {agentsInput = fakeInput;};
in
assert result == {test = {description = "test";};};
{result = "pass";};
in {
unknown-tool-throws = testUnknownTool;
load-canonical = testLoadCanonical;
}