test: add basic lib function tests for agents and coding-rules
This commit is contained in:
29
tests/lib/agents-test.nix
Normal file
29
tests/lib/agents-test.nix
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user