diff --git a/internal/web/uploads_progress_handler_test.go b/internal/web/uploads_progress_handler_test.go index 4a7f6ed..d1bdee0 100644 --- a/internal/web/uploads_progress_handler_test.go +++ b/internal/web/uploads_progress_handler_test.go @@ -252,7 +252,7 @@ func TestUploadProgress_TheFullPageCarriesTheVerySameProgressListAsTheFragment(t "the page a user opens and the fragment HTMX swaps in must show the same list, or the display jumps on the first poll") } -func TestUploadProgress_AStepNoteIsShownUnderItsStepAndEscaped(t *testing.T) { +func TestUploadProgress_AStepNoteIsShownDirectlyUnderItsStepAndEscaped(t *testing.T) { app, _ := newUploadApp(t, audioOK, 200<<20) fixedClock(app) id := seedUpload(t, userID, "m", "transcribing", "") @@ -262,7 +262,26 @@ func TestUploadProgress_AStepNoteIsShownUnderItsStepAndEscaped(t *testing.T) { b := statusBody(t, app, id) - assert.Contains(t, b, "The audio is 20 min long") + audio := strings.Index(b, "Preparing the audio") + note := strings.Index(b, "The audio is 20 min long") + next := strings.Index(b, "Transcribing with iguana/pianissimo") + require.True(t, audio >= 0 && note > audio && next > note, "the note must sit between its own step and the next one:\n%s", b) assert.Contains(t, b, "step-note") assert.NotContains(t, b, "cut off", "a note is words, never markup") } + +func TestUploadProgress_ADonePageShowsItsRecordOpenWhenAStepHasANote(t *testing.T) { + // A truncated recording must not look like a clean one: the note that replaced the + // refusal is the only warning, so it cannot sit inside a collapsed list (third review). + app, _ := newUploadApp(t, audioOK, 200<<20) + fixedClock(app) + noted := seedUpload(t, userID, "noted", "done", "Synthetic transcript text.") + steps := []domain.ProgressStep{step("audio", "Preparing the audio", domain.StepDone, 20*time.Minute, 40*time.Second, 0, 0)} + steps[0].Note = "The audio is 20 min long; the file claimed 1 h 19 min." + seedProgress(t, noted, steps, progressNow.Add(-time.Minute), progressNow.Add(-time.Minute)) + clean := seedUpload(t, userID, "clean", "done", "Synthetic transcript text.") + seedProgress(t, clean, []domain.ProgressStep{step("audio", "Preparing the audio", domain.StepDone, 20*time.Minute, 40*time.Second, 0, 0)}, progressNow.Add(-time.Minute), progressNow.Add(-time.Minute)) + + assert.Contains(t, statusBody(t, app, noted), `
`) + assert.NotContains(t, statusBody(t, app, clean), `
`, "a clean record stays collapsed") +}