From 2fc99fb5c4351986c9838ed8ebd7758f830c2dcd Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 23 May 2026 00:52:53 +0000 Subject: [PATCH] test: add integration test for idstack-learnings-delete Added integration tests for `idstack-learnings-delete` script in `test/integration-test.sh`. It tests successful deletion, handling missing files, non-existent keys, and missing arguments. Co-authored-by: savvides <1580637+savvides@users.noreply.github.com> --- test/integration-test.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/integration-test.sh b/test/integration-test.sh index bf45ca7..18b91dd 100755 --- a/test/integration-test.sh +++ b/test/integration-test.sh @@ -81,6 +81,26 @@ check "no file returns empty" \ echo "" +# --- idstack-learnings-delete --- +echo "## idstack-learnings-delete" + +$IDSTACK_DIR/bin/idstack-learnings-log '{"skill":"test","type":"operational","key":"to-delete","insight":"delete me","confidence":9}' +$IDSTACK_DIR/bin/idstack-learnings-log '{"skill":"test","type":"operational","key":"to-keep","insight":"keep me","confidence":9}' + +check "deletes specific learning by key" \ + "$IDSTACK_DIR/bin/idstack-learnings-delete to-delete && ! grep -q 'to-delete' .idstack/learnings.jsonl && grep -q 'to-keep' .idstack/learnings.jsonl" + +check "fails if key not found" \ + "! $IDSTACK_DIR/bin/idstack-learnings-delete non-existent-key 2>/dev/null" + +check "fails on missing arg" \ + "! $IDSTACK_DIR/bin/idstack-learnings-delete 2>/dev/null" + +check "fails if file missing" \ + "rm -f .idstack/learnings.jsonl && ! $IDSTACK_DIR/bin/idstack-learnings-delete to-keep 2>/dev/null" + +echo "" + # --- idstack-status --- echo "## idstack-status"