blob: 5ee80e67d136cdaca5e9c2f7ee2b2f24cbb3ddcd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
;;; test-transcription-paths.el --- Tests for transcription file path logic -*- lexical-binding: t; -*-
;;; Commentary:
;; Tests for cj/--transcription-output-files and cj/--transcription-script-path
;; Categories: Normal cases, Boundary cases, Error cases
;;; Code:
(require 'ert)
(require 'transcription-config)
;; ----------------------------- Normal Cases ----------------------------------
(ert-deftest test-cj/--transcription-output-files-simple ()
"Test output file paths for simple filename."
(let ((result (cj/--transcription-output-files "meeting.m4a")))
(should (string= (car result) "meeting.txt"))
(should (string= (cdr result) "meeting.log"))))
(ert-deftest test-cj/--transcription-output-files-with-path ()
"Test output file paths with full path."
(let ((result (cj/--transcription-output-files "/home/user/audio/podcast.mp3")))
(should (string= (car result) "/home/user/audio/podcast.txt"))
(should (string= (cdr result) "/home/user/audio/podcast.log"))))
(ert-deftest test-cj/--transcription-output-files-different-extensions ()
"Test output files for various audio extensions."
(dolist (ext '("m4a" "mp3" "wav" "flac" "ogg"))
(let* ((input (format "audio.%s" ext))
(result (cj/--transcription-output-files input)))
(should (string= (car result) "audio.txt"))
(should (string= (cdr result) "audio.log")))))
;; ----------------------------- Boundary Cases --------------------------------
(ert-deftest test-cj/--transcription-output-files-multiple-dots ()
"Test output files for filename with multiple dots."
(let ((result (cj/--transcription-output-files "meeting.2025-11-04.final.m4a")))
(should (string= (car result) "meeting.2025-11-04.final.txt"))
(should (string= (cdr result) "meeting.2025-11-04.final.log"))))
(ert-deftest test-cj/--transcription-output-files-no-extension ()
"Test output files for filename without extension."
(let ((result (cj/--transcription-output-files "meeting")))
(should (string= (car result) "meeting.txt"))
(should (string= (cdr result) "meeting.log"))))
(ert-deftest test-cj/--transcription-output-files-spaces-in-name ()
"Test output files for filename with spaces."
(let ((result (cj/--transcription-output-files "team meeting 2025.m4a")))
(should (string= (car result) "team meeting 2025.txt"))
(should (string= (cdr result) "team meeting 2025.log"))))
(ert-deftest test-cj/--transcription-output-files-special-chars ()
"Test output files for filename with special characters."
(let ((result (cj/--transcription-output-files "meeting_(final).m4a")))
(should (string= (car result) "meeting_(final).txt"))
(should (string= (cdr result) "meeting_(final).log"))))
;; ----------------------------- Script Path Tests -----------------------------
(ert-deftest test-cj/--transcription-script-path-local-whisper ()
"Test script path for local-whisper backend."
(let ((cj/transcribe-backend 'local-whisper))
(should (string-suffix-p "scripts/local-whisper"
(cj/--transcription-script-path)))))
(ert-deftest test-cj/--transcription-script-path-openai-api ()
"Test script path for openai-api backend."
(let ((cj/transcribe-backend 'openai-api))
(should (string-suffix-p "scripts/oai-transcribe"
(cj/--transcription-script-path)))))
(ert-deftest test-cj/--transcription-script-path-absolute ()
"Test that script path is absolute."
(let ((path (cj/--transcription-script-path)))
(should (file-name-absolute-p path))))
(provide 'test-transcription-paths)
;;; test-transcription-paths.el ends here
|