summaryrefslogtreecommitdiff
path: root/tests/test-transcription-log-cleanup.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-11-04 14:35:50 -0600
committerCraig Jennings <c@cjennings.net>2025-11-04 14:35:50 -0600
commit45cab5c38dc089935416a89d36b461d9127094ac (patch)
treeccfb33579de009c8c8694f2a79d10e487d74de8f /tests/test-transcription-log-cleanup.el
parentefbcd0b7de7993b9fde29297daad1154711a3e81 (diff)
feat: Add complete async audio transcription workflow
Implemented full transcription system with local Whisper and OpenAI API support. Includes comprehensive test suite (60 tests) and reorganized keybindings for better discoverability. Features: - Async transcription (non-blocking workflow) - Desktop notifications (started/complete/error) - Output: audio.txt (transcript) + audio.log (process logs) - Modeline integration showing active transcription count - Dired integration (press T on audio files) - Process management and tracking Scripts: - install-whisper.sh: Install Whisper via AUR or pip - uninstall-whisper.sh: Clean removal with cache cleanup - local-whisper: Offline transcription using installed Whisper - oai-transcribe: Cloud transcription via OpenAI API Tests (60 passing): - Audio file detection (16 tests) - Path generation logic (11 tests) - Log cleanup behavior (5 tests) - Duration formatting (9 tests) - Active counter & modeline (11 tests) - Integration workflows (8 tests) Keybindings: - Reorganized gcal to C-; g submenu (s/t/r/c) - Added C-; t transcription submenu (t/b/k) - Dired: T to transcribe file at point 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'tests/test-transcription-log-cleanup.el')
-rw-r--r--tests/test-transcription-log-cleanup.el44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/test-transcription-log-cleanup.el b/tests/test-transcription-log-cleanup.el
new file mode 100644
index 00000000..82c902d8
--- /dev/null
+++ b/tests/test-transcription-log-cleanup.el
@@ -0,0 +1,44 @@
+;;; test-transcription-log-cleanup.el --- Tests for log cleanup logic -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; Tests for cj/--should-keep-log function
+;; Categories: Normal cases, Boundary cases
+
+;;; Code:
+
+(require 'ert)
+(require 'transcription-config)
+
+;; ----------------------------- Normal Cases ----------------------------------
+
+(ert-deftest test-cj/--should-keep-log-success-keep-disabled ()
+ "Test that logs are deleted on success when keep-log is nil."
+ (let ((cj/transcription-keep-log-when-done nil))
+ (should-not (cj/--should-keep-log t))))
+
+(ert-deftest test-cj/--should-keep-log-success-keep-enabled ()
+ "Test that logs are kept on success when keep-log is t."
+ (let ((cj/transcription-keep-log-when-done t))
+ (should (cj/--should-keep-log t))))
+
+(ert-deftest test-cj/--should-keep-log-error-keep-disabled ()
+ "Test that logs are always kept on error, even if keep-log is nil."
+ (let ((cj/transcription-keep-log-when-done nil))
+ (should (cj/--should-keep-log nil))))
+
+(ert-deftest test-cj/--should-keep-log-error-keep-enabled ()
+ "Test that logs are kept on error when keep-log is t."
+ (let ((cj/transcription-keep-log-when-done t))
+ (should (cj/--should-keep-log nil))))
+
+;; ----------------------------- Boundary Cases --------------------------------
+
+(ert-deftest test-cj/--should-keep-log-default-behavior ()
+ "Test default behavior (should not keep on success)."
+ ;; Default is nil based on defcustom
+ (let ((cj/transcription-keep-log-when-done nil))
+ (should-not (cj/--should-keep-log t))
+ (should (cj/--should-keep-log nil))))
+
+(provide 'test-transcription-log-cleanup)
+;;; test-transcription-log-cleanup.el ends here