From a46f8af939b112b603a2c95b2e83a1932b208e20 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 26 Feb 2026 22:41:46 -0600 Subject: test(recording): add tests for label-devices, label-sinks, get-sink-apps Fill test gaps from quality-engineer review: 3 new test files (28 tests) and error cases for get-available-mics and get-available-sinks (+4 tests). --- tests/test-video-audio-recording--get-available-mics.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/test-video-audio-recording--get-available-mics.el') diff --git a/tests/test-video-audio-recording--get-available-mics.el b/tests/test-video-audio-recording--get-available-mics.el index 86a9d05c..5b549da3 100644 --- a/tests/test-video-audio-recording--get-available-mics.el +++ b/tests/test-video-audio-recording--get-available-mics.el @@ -109,5 +109,22 @@ Each source is (name description mute state)." ("sink-b.monitor" "Monitor B" "no" "SUSPENDED")))))) (should (null (cj/recording--get-available-mics))))) +;;; Error Cases + +(ert-deftest test-video-audio-recording--get-available-mics-error-garbled-output () + "Test that garbled pactl output returns empty list, not an error." + (cl-letf (((symbol-function 'shell-command-to-string) + (lambda (_cmd) "random garbage\nwith newlines\nbut no structure\n"))) + (should (null (cj/recording--get-available-mics))))) + +(ert-deftest test-video-audio-recording--get-available-mics-error-missing-fields () + "Test that source with partial fields does not crash." + (cl-letf (((symbol-function 'shell-command-to-string) + (lambda (_cmd) "Source #1\n\tState: RUNNING\n\tName: partial-source\n"))) + ;; Missing Description and Mute — should not error + (let ((mics (cj/recording--get-available-mics))) + ;; May return empty or partial; must not signal + (should (listp mics))))) + (provide 'test-video-audio-recording--get-available-mics) ;;; test-video-audio-recording--get-available-mics.el ends here -- cgit v1.2.3