summaryrefslogtreecommitdiff
path: root/tests/test-transcription-audio-file.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-audio-file.el
parent9d55ed149e100b4fb3ef6f5a79d263dcb26ce835 (diff)
Revert "checking in modified/removed tests and other misc changes"
This reverts commit 9d55ed149e100b4fb3ef6f5a79d263dcb26ce835.
Diffstat (limited to 'tests/test-transcription-audio-file.el')
-rw-r--r--tests/test-transcription-audio-file.el88
1 files changed, 88 insertions, 0 deletions
diff --git a/tests/test-transcription-audio-file.el b/tests/test-transcription-audio-file.el
new file mode 100644
index 00000000..ac4ff452
--- /dev/null
+++ b/tests/test-transcription-audio-file.el
@@ -0,0 +1,88 @@
+;;; test-transcription-audio-file.el --- Tests for audio file detection -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; Tests for cj/--audio-file-p function
+;; Categories: Normal cases, Boundary cases, Error 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/--audio-file-p-m4a ()
+ "Test that .m4a files are recognized as audio."
+ (should (cj/--audio-file-p "meeting.m4a")))
+
+(ert-deftest test-cj/--audio-file-p-mp3 ()
+ "Test that .mp3 files are recognized as audio."
+ (should (cj/--audio-file-p "podcast.mp3")))
+
+(ert-deftest test-cj/--audio-file-p-wav ()
+ "Test that .wav files are recognized as audio."
+ (should (cj/--audio-file-p "recording.wav")))
+
+(ert-deftest test-cj/--audio-file-p-flac ()
+ "Test that .flac files are recognized as audio."
+ (should (cj/--audio-file-p "music.flac")))
+
+(ert-deftest test-cj/--audio-file-p-with-path ()
+ "Test audio file recognition with full path."
+ (should (cj/--audio-file-p "/home/user/recordings/meeting.m4a")))
+
+;; ----------------------------- Boundary Cases --------------------------------
+
+(ert-deftest test-cj/--audio-file-p-uppercase-extension ()
+ "Test that uppercase extensions are recognized."
+ (should (cj/--audio-file-p "MEETING.M4A")))
+
+(ert-deftest test-cj/--audio-file-p-mixed-case ()
+ "Test that mixed case extensions are recognized."
+ (should (cj/--audio-file-p "podcast.Mp3")))
+
+(ert-deftest test-cj/--audio-file-p-no-extension ()
+ "Test that files without extension are not recognized."
+ (should-not (cj/--audio-file-p "meeting")))
+
+(ert-deftest test-cj/--audio-file-p-empty-string ()
+ "Test that empty string is not recognized as audio."
+ (should-not (cj/--audio-file-p "")))
+
+(ert-deftest test-cj/--audio-file-p-dotfile ()
+ "Test that dotfiles without proper extension are not recognized."
+ (should-not (cj/--audio-file-p ".hidden")))
+
+(ert-deftest test-cj/--audio-file-p-multiple-dots ()
+ "Test file with multiple dots but audio extension."
+ (should (cj/--audio-file-p "meeting.2025-11-04.final.m4a")))
+
+;; ------------------------------ Error Cases ----------------------------------
+
+(ert-deftest test-cj/--audio-file-p-not-audio ()
+ "Test that non-audio files are not recognized."
+ (should-not (cj/--audio-file-p "document.pdf")))
+
+(ert-deftest test-cj/--audio-file-p-text-file ()
+ "Test that text files are not recognized as audio."
+ (should-not (cj/--audio-file-p "notes.txt")))
+
+(ert-deftest test-cj/--audio-file-p-org-file ()
+ "Test that org files are not recognized as audio."
+ (should-not (cj/--audio-file-p "tasks.org")))
+
+(ert-deftest test-cj/--audio-file-p-video-file ()
+ "Test that video files are not recognized as audio."
+ (should-not (cj/--audio-file-p "video.mp4")))
+
+(ert-deftest test-cj/--audio-file-p-nil ()
+ "Test that nil input returns nil."
+ (should-not (cj/--audio-file-p nil)))
+
+(provide 'test-transcription-audio-file)
+;;; test-transcription-audio-file.el ends here