Files
memex/projects/org-skill-memex/tests/test-suite.lisp

56 lines
2.5 KiB
Common Lisp

;;; TDD Suite: org-skill-memex (Knowledge Management Standards)
;;; Status: RED (Initial Inception)
;;; Author: Tech-Analyst-Agent
;;; Created: [2026-03-31 Tue 12:50]
(defpackage :org-skill-memex-tests
(:use :cl :fiveam :org-skill-memex))
(in-package :org-skill-memex-tests)
(def-suite memex-integrity-suite
:description "Tests for metadata and structural integrity of the Memex.")
(in-suite memex-integrity-suite)
;;; --- 2.1 Metadata Integrity Audit Tests ---
(test audit-missing-created-property
"Ensure that entries missing the :CREATED: property are flagged."
(let ((test-file "/tmp/test-missing-created.org"))
(with-open-file (out test-file :direction :output :if-exists :supersede)
(format out "* TODO Entry without created property~% :PROPERTIES:~% :ID: 123~% :END:~%"))
(let ((result (memex-audit-metadata test-file)))
(is (member :missing-created (getf result :errors)))
(is (equal "Entry without created property" (getf (car (getf result :entries)) :title))))))
(test audit-misplaced-logbook
"Ensure that :LOGBOOK: drawers MUST come after :PROPERTIES:."
(let ((test-file "/tmp/test-bad-logbook.org"))
(with-open-file (out test-file :direction :output :if-exists :supersede)
(format out "* TODO Misplaced Logbook~% :LOGBOOK:~% - State \"DONE\" from \"TODO\" [2026-03-31]~% :END:~% :PROPERTIES:~% :CREATED: [2026-03-31]~% :END:~%"))
(let ((result (memex-audit-metadata test-file)))
(is (member :misplaced-logbook (getf result :errors))))))
;;; --- 2.2 GTD Task Promotion Tests ---
(test promote-sequential-task
"Ensure that completing a NEXT task promotes the next TODO in the same project."
(let ((project-id "test-project-promotion"))
;; Implementation of mock GTD state would go here
;; (is (equal "next-task-id" (memex-promote-next-task project-id)))
(skip "Mock GTD state machine required for promotion testing.")))
;;; --- 2.3 Agentic Distillation Tests ---
(test distill-concept-from-daily
"Ensure concepts are correctly extracted and backlinks added."
(let ((daily-file "/tmp/2026-03-31-test.org")
(concept "Lisp Sovereignty"))
(with-open-file (out daily-file :direction :output :if-exists :supersede)
(format out "* Lisp Sovereignty~% This is a timeless concept about control.~%"))
(let ((note-path (memex-distill-atomic-note daily-file concept)))
(is (cl-ppcre:scan "lisp_sovereignty.org" note-path))
(is (cl-ppcre:scan "Source: \\[\\[file:2026-03-31-test.org\\]\\]"
(uiop:read-file-string note-path))))))