summaryrefslogtreecommitdiff
path: root/tests/test-transcription-log-cleanup.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-11-14 02:35:00 -0600
committerCraig Jennings <c@cjennings.net>2025-11-14 02:35:00 -0600
commit0febc3bb65462fd95a75387c2ec97ffa374efc00 (patch)
tree95ff3ba5c3ab2da2a889530432d75e69ed993efa /tests/test-transcription-log-cleanup.el
parent9d55ed149e100b4fb3ef6f5a79d263dcb26ce835 (diff)
Revert "checking in modified/removed tests and other misc changes"
This reverts commit 9d55ed149e100b4fb3ef6f5a79d263dcb26ce835.
Diffstat (limited to 'tests/test-transcription-log-cleanup.el')
-rw-r--r--tests/test-transcription-log-cleanup.el49
1 files changed, 49 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..251e5ef9
--- /dev/null
+++ b/tests/test-transcription-log-cleanup.el
@@ -0,0 +1,49 @@
+;;; 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)
+
+;; Stub dependencies before loading the module
+(defvar cj/custom-keymap (make-sparse-keymap)
+ "Stub keymap for testing.")
+
+(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