diff --git a/cmd/server/tests/podcast_test.go b/cmd/server/tests/podcast_test.go index 8f42749d..c3993113 100644 --- a/cmd/server/tests/podcast_test.go +++ b/cmd/server/tests/podcast_test.go @@ -531,13 +531,31 @@ func TestPodcastPlayerOrderControl(t *testing.T) { // match the escaped form. esc := func(s string) string { return strings.ReplaceAll(s, `"`, """) } - t.Run("context_carries_feed_source", func(t *testing.T) { + t.Run("unset_default_is_reversed", func(t *testing.T) { + // 2026-11-01: the UNSET per-feed order resolves to "reverse" + // (audiobook-first — feed document order runs newest-first, so + // native started a book at its last chapter). The player's + // sequence config carries it; the podcast page's dropdown shows + // it selected; ep1 (feed position 1 of 2) plays LAST. code, body := podcastAuthed(t, setup, setup.Token, "GET", ep1URL, "") require.Equal(t, http.StatusOK, code) assert.Contains(t, string(body), esc(`"source":"feed"`), "queue context must carry its owner (§10 R2)") assert.Contains(t, string(body), esc(`"feed_id":"`+feedID+`"`)) - assert.Contains(t, string(body), esc(`"order":"native"`)) - assert.Contains(t, string(body), esc(`"episode_index":1`)) + assert.Contains(t, string(body), esc(`"order":"reverse"`), + "unset order defaults to reversed (audiobook-first)") + assert.Contains(t, string(body), esc(`"episode_index":2`), + "feed position 1 plays last under the reversed default") + }) + + t.Run("podcast_page_dropdown_shows_reversed_when_unset", func(t *testing.T) { + code, body := podcastAuthed(t, setup, setup.Token, "GET", "/podcasts/"+feedID, "") + require.Equal(t, http.StatusOK, code) + html := string(body) + assert.Contains(t, html, `id="podcast-order-select"`, "the feed page renders its Order dropdown") + assert.Contains(t, html, `