From 1752c6e58906721a47afc56e357b7fb1c0c8a5a1 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 21 Nov 2025 08:43:19 -0800 Subject: feat(org-noter): implement custom org-noter workflow Implemented custom org-noter workflow with F6 keybinding: - Creates notes files as org-roam nodes in org-roam-directory - Title prompt with pre-slugified default, notes-on-{slug}.org format - F6 toggles notes window visibility when session active - Preserves PDF fit setting on toggle - Deferred org-roam integration to prevent PDF open hang Also fixed: quick-sdcv quit binding, calendar-sync sentinel buffer error Added 30 ERT tests for title-to-slug and template generation functions --- tests/test-org-noter--title-to-slug.el | 100 +++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 tests/test-org-noter--title-to-slug.el (limited to 'tests/test-org-noter--title-to-slug.el') diff --git a/tests/test-org-noter--title-to-slug.el b/tests/test-org-noter--title-to-slug.el new file mode 100644 index 00000000..b6880cf6 --- /dev/null +++ b/tests/test-org-noter--title-to-slug.el @@ -0,0 +1,100 @@ +;;; test-org-noter--title-to-slug.el --- Tests for cj/org-noter--title-to-slug -*- lexical-binding: t; -*- + +;;; Commentary: +;; ERT tests for the title-to-slug function used in org-noter workflow. +;; Tests cover normal, boundary, and error cases. + +;;; Code: + +(require 'ert) +(require 'org-noter-config) + +;;; Normal Cases + +(ert-deftest test-org-noter--title-to-slug-normal-simple-title () + "Normal case: Simple title with spaces." + (should (equal (cj/org-noter--title-to-slug "The Pragmatic Programmer") + "the-pragmatic-programmer"))) + +(ert-deftest test-org-noter--title-to-slug-normal-single-word () + "Normal case: Single word title." + (should (equal (cj/org-noter--title-to-slug "Dune") + "dune"))) + +(ert-deftest test-org-noter--title-to-slug-normal-with-numbers () + "Normal case: Title with numbers." + (should (equal (cj/org-noter--title-to-slug "1984 by George Orwell") + "1984-by-george-orwell"))) + +(ert-deftest test-org-noter--title-to-slug-normal-mixed-case () + "Normal case: Title with mixed case." + (should (equal (cj/org-noter--title-to-slug "SICP Structure and Interpretation") + "sicp-structure-and-interpretation"))) + +;;; Boundary Cases + +(ert-deftest test-org-noter--title-to-slug-boundary-special-chars () + "Boundary case: Title with special characters." + (should (equal (cj/org-noter--title-to-slug "C++: The Complete Guide") + "c-the-complete-guide"))) + +(ert-deftest test-org-noter--title-to-slug-boundary-punctuation () + "Boundary case: Title with punctuation." + (should (equal (cj/org-noter--title-to-slug "Why's (Poignant) Guide to Ruby") + "why-s-poignant-guide-to-ruby"))) + +(ert-deftest test-org-noter--title-to-slug-boundary-leading-special () + "Boundary case: Title starting with special character." + (should (equal (cj/org-noter--title-to-slug "...And Then There Were None") + "and-then-there-were-none"))) + +(ert-deftest test-org-noter--title-to-slug-boundary-trailing-special () + "Boundary case: Title ending with special character." + (should (equal (cj/org-noter--title-to-slug "What Is This Thing Called Love?") + "what-is-this-thing-called-love"))) + +(ert-deftest test-org-noter--title-to-slug-boundary-multiple-spaces () + "Boundary case: Title with multiple consecutive spaces." + (should (equal (cj/org-noter--title-to-slug "The Great Gatsby") + "the-great-gatsby"))) + +(ert-deftest test-org-noter--title-to-slug-boundary-underscores () + "Boundary case: Title with underscores." + (should (equal (cj/org-noter--title-to-slug "file_name_example") + "file-name-example"))) + +(ert-deftest test-org-noter--title-to-slug-boundary-hyphens () + "Boundary case: Title with existing hyphens." + (should (equal (cj/org-noter--title-to-slug "Self-Reliance") + "self-reliance"))) + +(ert-deftest test-org-noter--title-to-slug-boundary-all-numbers () + "Boundary case: Title that is all numbers." + (should (equal (cj/org-noter--title-to-slug "2001") + "2001"))) + +;;; Edge Cases + +(ert-deftest test-org-noter--title-to-slug-edge-empty-string () + "Edge case: Empty string." + (should (equal (cj/org-noter--title-to-slug "") + ""))) + +(ert-deftest test-org-noter--title-to-slug-edge-only-special-chars () + "Edge case: Only special characters." + (should (equal (cj/org-noter--title-to-slug "!@#$%^&*()") + ""))) + +(ert-deftest test-org-noter--title-to-slug-edge-unicode () + "Edge case: Title with unicode characters." + (should (equal (cj/org-noter--title-to-slug "Café au Lait") + "caf-au-lait"))) + +(ert-deftest test-org-noter--title-to-slug-edge-long-title () + "Edge case: Very long title." + (let ((long-title "The Absolutely Incredibly Long Title of This Book That Goes On and On")) + (should (equal (cj/org-noter--title-to-slug long-title) + "the-absolutely-incredibly-long-title-of-this-book-that-goes-on-and-on")))) + +(provide 'test-org-noter--title-to-slug) +;;; test-org-noter--title-to-slug.el ends here -- cgit v1.2.3