| 1 | package serve |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | // Canonical /sessions rows carry an empty path, so a resume that sends only |
| 9 | // the path cannot name the row the user clicked. |
| 10 | func TestServeIndexResumesSessionByIdentity(t *testing.T) { |
| 11 | html := string(indexHTML) |
| 12 | for _, want := range []string{ |
| 13 | "post('/resume',{path:s.path,sessionId:s.sessionId,hostId:s.hostId,name:s.name})", |
| 14 | "if(!r.ok){const detail=(await r.text().catch(()=>'')).trim();showNotice(__('resume_failed')", |
| 15 | "'resume_failed': 'Could not switch to that session'", |
| 16 | "'resume_failed': '无法切换到该会话'", |
| 17 | } { |
| 18 | if !strings.Contains(html, want) { |
| 19 | t.Fatalf("serve index missing session resume handling %q", want) |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 |