diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-06 14:07:03 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-06 14:07:03 -0500 |
| commit | 5e03a15f47bdc1354554584f4939b303b52d9b75 (patch) | |
| tree | 864826aa6263bdab724a4fdaa541b35ee98d6fdf /tests | |
| parent | 830654d2a5af29d6df5d61d061417a1a7503ab42 (diff) | |
| download | dotemacs-5e03a15f47bdc1354554584f4939b303b52d9b75.tar.gz dotemacs-5e03a15f47bdc1354554584f4939b303b52d9b75.zip | |
feat(music): radio row for name, tag, and manual station search
I turned the radio-browser lookup into a Radio row in the playlist buffer: n searches by station name, t searches by tag/genre, m enters a station by hand. Tag search is new (it was a vNext item), and both name and tag hit radio-browser's search endpoint with a name= or tag= field.
Freeing n and t moved two keys: single mode goes from t to s, and stop goes from s to S. The header gains a Radio row and the Mode row now reads [s] single. Created station files carry a -Radio suffix (Adroit_Jazz_Underground-Radio.m3u).
The pure pieces and the search-URL field are unit-tested (20). Name and tag searches are live-verified. The picker and playback stay a manual check.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-music-config--radio.el | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/test-music-config--radio.el b/tests/test-music-config--radio.el index b8ce5e30..98368d76 100644 --- a/tests/test-music-config--radio.el +++ b/tests/test-music-config--radio.el @@ -129,13 +129,19 @@ ;;; --------------------------- search-url ------------------------------------- (ert-deftest test-music-radio-search-url-encodes-query-and-limit () - "Normal: the search URL hex-encodes the query and carries the limit." + "Normal: the search URL hex-encodes the query and carries the limit; name is the default field." (let* ((cj/music-radio-search-limit 30) (u (cj/music-radio--search-url "de1.api.radio-browser.info" "smooth jazz"))) - (should (string-match-p "smooth%20jazz" u)) + (should (string-match-p "name=smooth%20jazz" u)) (should (string-match-p "limit=30" u)) (should (string-match-p "/json/stations/search" u)))) +(ert-deftest test-music-radio-search-url-tag-field () + "Normal: field \"tag\" searches the tag= parameter instead of name=." + (let ((u (cj/music-radio--search-url "de1.api.radio-browser.info" "ambient" "tag"))) + (should (string-match-p "tag=ambient" u)) + (should-not (string-match-p "name=ambient" u)))) + (declare-function cj/music-radio--candidates "music-config" (stations)) (declare-function cj/music-radio--write-stations "music-config" (stations dir)) @@ -173,6 +179,16 @@ (should (file-exists-p (car (plist-get result :written))))) (delete-directory dir t)))) +(ert-deftest test-music-radio-write-stations-radio-suffix () + "Normal: a written filename carries the -Radio suffix before .m3u." + (let ((dir (make-temp-file "radio-write-" t))) + (unwind-protect + (let* ((result (cj/music-radio--write-stations (list (test-music-radio--first)) dir)) + (path (car (plist-get result :written)))) + (should (string-suffix-p "-Radio.m3u" path)) + (should (string-match-p "Adroit_Jazz_Underground-Radio\\.m3u\\'" path))) + (delete-directory dir t)))) + (ert-deftest test-music-radio-write-stations-collision-writes-two-files () "Boundary: two same-named stations in one run write two distinct files, no overwrite." (let ((dir (make-temp-file "radio-write-" t))) |
