Leave resuming to Equipo: Base sends nothing after connecting Oficina
Paul chose not to show a line for the person. Equipo will start the resumed turn itself when the connect card resolves, so Base drops its send and the PENDING copy row, and keeps "Oficina connected." as the one-time note in the conversation. The live stream already shows a turn the person did not send: the browser test now covers one running when Home loads and one arriving live, each with the thinking bubble and its answer streaming in below the note, a quiet team_update beside it adding no bubble, and nothing sent for the person whatever the outcome.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+97
−178
docs/copy-pending.md+0 −6internal/browsertest/oficina_resume_test.go+75 −56internal/equipo/equipotest/chat.go+3 −0internal/web/ask_oficina.go+5 −39internal/webtest/oficina_connect_test.go+14 −77
diff --git a/docs/copy-pending.md b/docs/copy-pending.md| index 4dac971..4dada16 100644 |
| --- a/docs/copy-pending.md |
| +++ b/docs/copy-pending.md |
| @@ -417,9 +417,3 @@ Review 12 (approved, Paul, 2026-11-17, copy review hwmz4ttgslm5ed3k4lafixgffa): |
| | partials/chat.html, ask.js | APPROVED (Paul, 2026-11-17): the button at the end of the Assistant's reply, beside the Oficina mark | Connect Oficina | |
| | partials/chat.html, ask.js | APPROVED (Paul, 2026-11-17): the line under the button, naming what connecting unlocks | Calendar, Docs, Sheets and more | |
| | ask.js | APPROVED (Paul, 2026-11-17): what the button becomes once Oficina is connected, after a tick icon (proposed as "Connected ✓"; the tick is drawn, not typed) | Connected | |
| - |
| -Review 13 (PENDING, drafted 2026-11-19): going on after connecting Oficina. Back from connecting Oficina in the chat, Base sends one line for the person, which shows as their message in the conversation, and the Assistant answers what they asked with Oficina now connected. The approved "Oficina connected." now shows only when that line could not be sent. The other approved lines (turned down, expired, unreachable) now sit in the conversation after the reply that asked, not under it. |
| - |
| -| File | Context | Text | |
| -|---|---|---| |
| -| ask_oficina.go | PENDING: the person's line Base sends once Oficina is connected from the chat; it shows as their own message, and the Assistant reads it as the go-ahead to carry on with what they asked | I've connected Oficina. Go ahead. | |
diff --git a/internal/browsertest/oficina_resume_test.go b/internal/browsertest/oficina_resume_test.go| index 4015f8a..771b2cc 100644 |
| --- a/internal/browsertest/oficina_resume_test.go |
| +++ b/internal/browsertest/oficina_resume_test.go |
| @@ -4,7 +4,6 @@ package browsertest |
| import ( |
| "net/url" |
| - "regexp" |
| "strconv" |
| "strings" |
| "testing" |
| @@ -17,8 +16,6 @@ import ( |
| "amadan.net/carlos/base/internal/equipo/equipotest" |
| ) |
| -const resumeText = "I've connected Oficina. Go ahead." |
| - |
| // personSends counts the person's messages Base sent to Equipo. |
| func personSends(f *equipotest.Fake) int { |
| n := 0 |
| @@ -35,82 +32,104 @@ const threadJS = `[...document.querySelectorAll("#ask-panel .thread > li")].map( |
| (li.matches(".ask-notice") ? "note" : li.matches(".thinking") ? "thinking" : li.matches(".person") ? "person" : li.matches(".connect-offer") ? "offer" : "assistant") |
| + ": " + li.textContent.trim()).join("\n")` |
| -// Back from connecting Oficina in the chat, the conversation goes on by |
| -// itself: the person's line saying so, then the Assistant thinking (its |
| -// spark bubble and dots) and answering what they asked. Once: a reload |
| -// sends nothing more. Turned down, nothing is sent; the chat says so in |
| -// the conversation, after the reply that asked, and what comes later goes |
| -// below the note. |
| +// Back from connecting Oficina in the chat, Base sends nothing; the chat |
| +// says "Oficina connected." once, after the reply that asked. Equipo goes on |
| +// by itself: a turn the person did not send shows the Assistant thinking |
| +// (its spark bubble and dots) and its answer streaming in, whether the |
| +// turn is already running when Home loads or arrives on the live stream. |
| +// Turned down, the note says so in the same place, and what comes later |
| +// goes below it. |
| func TestAskOficinaResumesAfterConnect(t *testing.T) { |
| rig, f := askBase(t) |
| th := thinking{t, rig, f} |
| + done := rig.Origin + "/ask/oficina/done?" + url.Values{"oficina_state": {strings.Repeat("s", 12)}, "oficina_code": {strings.Repeat("c", 12)}}.Encode() |
| + // asked: the person asks, and the Assistant asks them to connect. |
| + asked := func(text string, replies int) { |
| + t.Helper() |
| + f.Reply = func(string) string { return "Connect Oficina so I can add it to your calendar." } |
| + drive(t, rig, chromedp.SendKeys(chromedp.CSS(`#ask-text`), text+"\r")) |
| + // The reply has landed and its turn ended (Stop gone), so Equipo has it. |
| + th.wait(`[...document.querySelectorAll("#ask-panel .thread > li.msg.coordinator:not(.thinking):not(.draft)")].length === ` + strconv.Itoa(replies) + ` && |
| + document.querySelector("#ask-panel form.composer button.stop").hidden`) |
| + f.RaiseConnect("", rig.Origin+"/ask/oficina/connect") |
| + th.wait(`!!document.querySelector("#ask-panel .thread a.connect-btn")`) |
| + } |
| + back := func(target string) { |
| + t.Helper() |
| + drive(t, rig, chromedp.Navigate(target), chromedp.WaitVisible(chromedp.CSS(`#ask-panel textarea`)), |
| + chromedp.Poll[chromedp.Void](readJS, chromedp.WithPollingTimeout(5*time.Second)), chromedp.Sleep(300*time.Millisecond)) |
| + } |
| + // answer streams reply into turn id and lands it. |
| + answer := func(id, reply string) { |
| + t.Helper() |
| + f.Stream(id, reply) |
| + th.wait(`(document.querySelector(` + strconv.Quote(thinkingSel+", #ask-panel .thread > li[data-draft]") + `)?.textContent || "").includes(` + strconv.Quote(strings.Fields(reply)[0]) + `)`) |
| + f.Answer(id, reply, false) |
| + th.wait(`!document.querySelector("#ask-panel .thinking, #ask-panel [data-draft]") && document.querySelector("#ask-panel .thread > li:last-child").textContent === ` + strconv.Quote(reply)) |
| + } |
| + |
| openPanel(t, rig) |
| - f.Reply = func(string) string { return "Connect Oficina so I can add it to your calendar." } |
| - drive(t, rig, chromedp.SendKeys(chromedp.CSS(`#ask-text`), "Add getting coffee at 9:30 today\r")) |
| - th.wait(`document.querySelectorAll("#ask-panel .thread > li.msg.coordinator:not(.thinking):not(.draft)").length === 1 && |
| - document.querySelector("#ask-panel form.composer button.stop").hidden`) |
| - f.RaiseConnect("", rig.Origin+"/ask/oficina/connect") |
| - th.wait(`!!document.querySelector("#ask-panel .thread a.connect-btn")`) |
| - before := personSends(f) |
| + asked("Add getting coffee at 9:30 today", 1) |
| + sent := personSends(f) |
| - // Connected: Base sends the person's line and the Assistant works on it. |
| - f.Hold = true |
| - done := rig.Origin + "/ask/oficina/done?" + url.Values{"oficina_state": {strings.Repeat("s", 12)}, "oficina_code": {strings.Repeat("c", 12)}}.Encode() |
| - drive(t, rig, chromedp.Navigate(done), chromedp.WaitVisible(chromedp.CSS(`#ask-panel textarea`)), |
| - chromedp.Poll[chromedp.Void](readJS, chromedp.WithPollingTimeout(5*time.Second))) |
| + // Connected, with Equipo's turn already running when Home loads. |
| + back(done) |
| + if n := personSends(f); n != sent { |
| + t.Errorf("connecting sent %d messages", n-sent) |
| + } |
| + id := f.EmitTurn("", "running") |
| + back(rig.Origin + "/") |
| th.wait(`!!document.querySelector(` + strconv.Quote(thinkingSel+" .dots") + `)`) |
| - if n := personSends(f); n != before+1 { |
| - t.Fatalf("sent %d messages on connecting, want 1", n-before) |
| + if got := th.eval(threadJS); !strings.HasSuffix(got, "assistant: Connect Oficina so I can add it to your calendar.\nthinking: ") { |
| + t.Errorf("the turn running at load, the conversation is:\n%s", got) |
| } |
| - got := th.eval(threadJS) |
| - if !strings.HasSuffix(got, "person: "+resumeText+"\nthinking: ") || strings.Contains(got, "note:") { |
| + answer(id, "Added getting coffee to your calendar today.") |
| + |
| + // Connected again, the turn arriving on the live stream: the note, |
| + // then the Assistant thinking below it, then its answer in place. |
| + asked("Add lunch at 1", 3) |
| + sent = personSends(f) |
| + back(done) |
| + if got := th.eval(threadJS); !strings.HasSuffix(got, "assistant: Connect Oficina so I can add it to your calendar.\nnote: Oficina connected.") { |
| t.Errorf("after connecting, the conversation is:\n%s", got) |
| } |
| - if harness.Evaluate[string](rig, `location.pathname + location.search`) != "/" { |
| - t.Errorf("the return address stays in the address bar") |
| + id = f.EmitTurn("", "queued") |
| + th.wait(`!!document.querySelector(` + strconv.Quote(thinkingSel+" .dots") + `)`) |
| + if got := th.eval(threadJS); !strings.HasSuffix(got, "note: Oficina connected.\nthinking: ") { |
| + t.Errorf("the turn arriving live, the conversation is:\n%s", got) |
| } |
| viewportShot(t, rig, "oficina-resume-thinking") |
| - |
| - // A reload sends nothing more, and still shows the Assistant at work. |
| - openPanel(t, rig) |
| - th.wait(`!!document.querySelector(` + strconv.Quote(thinkingSel) + `)`) |
| - if n := personSends(f); n != before+1 { |
| - t.Errorf("a reload sent again: %d", n-before) |
| + f.EmitTurn("team_update", "running") // quiet: no second bubble |
| + drive(t, rig, chromedp.Sleep(300*time.Millisecond)) |
| + if n := harness.Evaluate[int](rig, `document.querySelectorAll("#ask-panel .thinking").length`); n != 1 { |
| + t.Errorf("%d thinking bubbles", n) |
| } |
| - if n := strings.Count(th.eval(threadJS), resumeText); n != 1 { |
| - t.Errorf("the person's line shows %d times", n) |
| + f.RunTurn(id) |
| + answer(id, "Added lunch to your calendar today, 1 to 2 pm.") |
| + if got := th.eval(threadJS); !strings.HasSuffix(got, "note: Oficina connected.\nassistant: Added lunch to your calendar today, 1 to 2 pm.") { |
| + t.Errorf("the answer is not where the bubble was:\n%s", got) |
| } |
| - // The Assistant answers in place. |
| - m := regexp.MustCompile(`^/ask/turns/([^/]+)/cancel$`).FindStringSubmatch(th.eval(`document.querySelector("#ask-panel form.cancel").getAttribute("action")`)) |
| - if m == nil { |
| - t.Fatal("no turn running") |
| + if n := personSends(f); n != sent { |
| + t.Errorf("Base sent %d messages for the person", n-sent) |
| } |
| - f.Answer(m[1], "Added “Getting coffee” to your calendar today, 9:30–10:30 am.", false) |
| - th.wait(`!document.querySelector("#ask-panel .thinking") && document.querySelector("#ask-panel .thread > li:last-child").textContent.startsWith("Added")`) |
| - f.Hold = false |
| - // Turned down (or cancelled): nothing is sent; the note follows the |
| - // reply that asked, and the next exchange goes below it. |
| - f.Reply = func(string) string { return "Connect Oficina so I can add it to your calendar." } |
| - drive(t, rig, chromedp.SendKeys(chromedp.CSS(`#ask-text`), "Add lunch at 1\r")) |
| - // The reply has landed and its turn ended (Stop gone), so Equipo has it. |
| - th.wait(`[...document.querySelectorAll("#ask-panel .thread > li.msg.coordinator:not(.thinking):not(.draft)")].length === 3 && |
| - document.querySelector("#ask-panel form.composer button.stop").hidden`) |
| - sent := personSends(f) |
| - drive(t, rig, chromedp.Navigate(rig.Origin+"/ask/oficina/done?oficina=denied"), chromedp.WaitVisible(chromedp.CSS(`#ask-panel textarea`)), |
| - chromedp.Poll[chromedp.Void](readJS, chromedp.WithPollingTimeout(5*time.Second)), chromedp.Sleep(300*time.Millisecond)) |
| + // Turned down: nothing is sent; the note follows the reply that |
| + // asked, and the next exchange goes below it. |
| + asked("Add dinner at 7", 5) |
| + sent = personSends(f) |
| + back(rig.Origin + "/ask/oficina/done?oficina=denied") |
| if n := personSends(f); n != sent { |
| t.Errorf("turning it down sent %d messages", n-sent) |
| } |
| - if got := th.eval(threadJS); !strings.HasSuffix(got, "assistant: Connect Oficina so I can add it to your calendar.\nnote: Oficina wasn't connected.") || |
| - strings.Contains(got, "thinking:") { |
| + // (The card is still open, so its button ends the reply that asked.) |
| + if got := th.eval(threadJS); !strings.Contains(got, "person: Add dinner at 7\nassistant: Connect Oficina so I can add it to your calendar.") || |
| + !strings.HasSuffix(got, "Calendar, Docs, Sheets and more\nnote: Oficina wasn't connected.") || strings.Contains(got, "thinking:") { |
| t.Errorf("after turning it down, the conversation is:\n%s", got) |
| } |
| f.Reply = func(string) string { return "Nothing else today." } |
| drive(t, rig, chromedp.SendKeys(chromedp.CSS(`#ask-text`), "What else is on?\r")) |
| th.wait(`document.querySelector("#ask-panel .thread > li:last-child").textContent.startsWith("Nothing else today.")`) |
| - got = th.eval(threadJS) |
| - if !strings.Contains(got, "note: Oficina wasn't connected.\nperson: What else is on?\nassistant: Nothing else today.") { |
| + if got := th.eval(threadJS); !strings.Contains(got, "note: Oficina wasn't connected.\nperson: What else is on?\nassistant: Nothing else today.") { |
| t.Errorf("later lines do not follow the note:\n%s", got) |
| } |
| viewportShot(t, rig, "oficina-note-in-conversation") |
diff --git a/internal/equipo/equipotest/chat.go b/internal/equipo/equipotest/chat.go| index 00606a8..6158a9d 100644 |
| --- a/internal/equipo/equipotest/chat.go |
| +++ b/internal/equipo/equipotest/chat.go |
| @@ -553,6 +553,9 @@ func (f *Fake) Glance(id, text string) { |
| f.emitLive("glance", "turn", id, 0, id, map[string]string{"turn_id": id, "text": text}) |
| } |
| +// RunTurn moves the turn with id to running, as a runner taking it does. |
| +func (f *Fake) RunTurn(id string) { f.setTurn(id, "running", "") } |
| + |
| // FailTurn ends the turn with id unanswered: failed. |
| func (f *Fake) FailTurn(id string) { f.setTurn(id, "failed", "") } |
diff --git a/internal/web/ask_oficina.go b/internal/web/ask_oficina.go| index 6086fdc..4ac35ec 100644 |
| --- a/internal/web/ask_oficina.go |
| +++ b/internal/web/ask_oficina.go |
| @@ -1,8 +1,6 @@ |
| package web |
| import ( |
| - "crypto/sha256" |
| - "encoding/hex" |
| "errors" |
| "net/http" |
| "net/url" |
| @@ -32,11 +30,6 @@ var oficinaNotes = map[string]string{ |
| "unavailable": "Couldn't reach Oficina. Try again later.", |
| } |
| -// oficinaResume is what Base sends for the person once Oficina is |
| -// connected from the chat, so the Assistant goes on with what they asked |
| -// (PENDING copy: docs/copy-pending.md, oficina.resume). |
| -const oficinaResume = "I've connected Oficina. Go ahead." |
| - |
| // quiet marks a response as one no cache keeps and no Referer follows: its |
| // URL may carry a code. |
| func quiet(w http.ResponseWriter) { |
| @@ -80,37 +73,17 @@ func (a *app) oficinaBearer(w http.ResponseWriter, r *http.Request) (askConn, bo |
| // ("" says nothing), and the chat open so they see it. |
| func (a *app) oficinaBack(w http.ResponseWriter, r *http.Request, me store.Member, outcome string) { |
| if _, ok := oficinaNotes[outcome]; ok { |
| - a.oficinaDock(r, me) |
| + if me.AskClosed { |
| + if err := store.SetAskClosed(r.Context(), a.db, me.ID, false); err != nil { |
| + a.logger.Error("ask: dock", "err", err) |
| + } |
| + } |
| http.SetCookie(w, &http.Cookie{Name: oficinaNote, Value: outcome, Path: "/", MaxAge: 120, |
| HttpOnly: true, Secure: strings.HasPrefix(a.cfg.Origin, "https://"), SameSite: http.SameSiteLaxMode}) |
| } |
| http.Redirect(w, r, "/", http.StatusSeeOther) |
| } |
| -// oficinaDock opens the member's docked chat, so they see what happened. |
| -func (a *app) oficinaDock(r *http.Request, me store.Member) { |
| - if me.AskClosed { |
| - if err := store.SetAskClosed(r.Context(), a.db, me.ID, false); err != nil { |
| - a.logger.Error("ask: dock", "err", err) |
| - } |
| - } |
| -} |
| - |
| -// oficinaResumed goes on with the conversation once Oficina is connected: |
| -// it sends oficinaResume for the person, so the Assistant answers what |
| -// they asked now that it can, and reports whether Equipo took it. Only a |
| -// finished consent comes here, and its key is the consent's own (a hash |
| -// of its state), so a second return with the same consent sends nothing |
| -// more: Equipo keeps one message per key. |
| -func (a *app) oficinaResumed(r *http.Request, c askConn, state string) bool { |
| - sum := sha256.Sum256([]byte("base.oficina.resume\x00" + state)) |
| - if _, err := a.ask.client.Send(r.Context(), c.token, oficinaResume, "oficina-"+hex.EncodeToString(sum[:20])); err != nil { |
| - a.logger.Warn("ask: oficina resume", "err", err) |
| - return false |
| - } |
| - return true |
| -} |
| - |
| // oficinaLost handles Equipo refusing the bearer: reconnect. |
| func (a *app) oficinaFailed(w http.ResponseWriter, r *http.Request, c askConn, err error) { |
| if errors.Is(err, equipo.ErrUnauthenticated) { |
| @@ -170,13 +143,6 @@ func (a *app) askOficinaDone(w http.ResponseWriter, r *http.Request) { |
| if _, known := oficinaNotes[status]; !known { |
| status = "unavailable" |
| } |
| - // Connected: the chat goes on, and says so by doing it; the note is |
| - // for when it could not. |
| - if status == "connected" && a.oficinaResumed(r, c, state) { |
| - a.oficinaDock(r, c.me) |
| - http.Redirect(w, r, "/", http.StatusSeeOther) |
| - return |
| - } |
| a.oficinaBack(w, r, c.me, status) |
| } |
diff --git a/internal/webtest/oficina_connect_test.go b/internal/webtest/oficina_connect_test.go| index 14369b3..de720ea 100644 |
| --- a/internal/webtest/oficina_connect_test.go |
| +++ b/internal/webtest/oficina_connect_test.go |
| @@ -126,10 +126,13 @@ func TestOficinaDoneFinishesWithTheBearer(t *testing.T) { |
| !strings.Contains(calls[0].Body, `"state":"`+st+`"`) || !strings.Contains(calls[0].Body, `"code":"`+code+`"`) { |
| t.Fatalf("calls: %+v", calls) |
| } |
| - // The chat goes on with what the person asked, and nothing secret is |
| - // logged. |
| - if home := a.get("/"); !strings.Contains(strings.ReplaceAll(home.Body, "'", "'"), resumeText) { |
| - t.Fatalf("home lacks the resumed conversation:\n%s", home.Body) |
| + // The outcome reaches the chat once, and nothing secret is logged. |
| + home := a.get("/") |
| + if !strings.Contains(home.Body, "Oficina connected.") { |
| + t.Fatalf("home lacks the note:\n%s", home.Body) |
| + } |
| + if again := a.get("/"); strings.Contains(again.Body, "Oficina connected.") { |
| + t.Errorf("the note showed twice") |
| } |
| for _, secret := range []string{st, code} { |
| if strings.Contains(a.logs.String(), secret) { |
| @@ -142,7 +145,7 @@ func TestOficinaDoneOutcomes(t *testing.T) { |
| a, f := newAskApp(t) |
| a.connectEquipo(f) |
| for _, c := range []struct{ finish, want string }{ |
| - {"connected", resumeText}, |
| + {"connected", "Oficina connected."}, |
| {"denied", "Oficina wasn't connected."}, |
| {"expired", "That link expired. Try again."}, |
| {"unavailable", "Couldn't reach Oficina. Try again later."}, |
| @@ -229,11 +232,6 @@ func TestOficinaConnectCardLinkKeepsItsRel(t *testing.T) { |
| } |
| } |
| -// resumeText is what Base sends for the person once Oficina is connected |
| -// from the chat, so the Assistant goes on with what they asked |
| -// (PENDING copy: docs/copy-pending.md). |
| -const resumeText = "I've connected Oficina. Go ahead." |
| - |
| // sends are the person's messages Base sent to Equipo, oldest first. |
| func sends(f *equipotest.Fake) []string { |
| var out []string |
| @@ -245,62 +243,17 @@ func sends(f *equipotest.Fake) []string { |
| return out |
| } |
| -// Connected from the chat, Base goes on with the conversation: it sends |
| -// one message for the person, with their bearer, so the Assistant answers |
| -// what they asked now that it can. Home shows it and the Assistant at |
| -// work, not the note. Home again, or the same return again, sends nothing |
| -// more. |
| -func TestOficinaDoneConnectedResumesOnce(t *testing.T) { |
| - a, f := newAskApp(t) |
| - token := a.connectEquipo(f) |
| - f.Hold = true |
| - if r := a.get(doneURL(fakeState(), fakeCode())); r.Code != 303 || r.Location() != "/" || strings.Contains(r.Header.Get("Set-Cookie"), "oficina_note") { |
| - t.Fatalf("done: %d %q %v", r.Code, r.Location(), r.Header) |
| - } |
| - calls := f.Calls("/api/v1/assistant/messages") |
| - if len(calls) != 1 || calls[0].Method != "POST" || calls[0].Header.Get("Authorization") != "Bearer "+token || |
| - !strings.Contains(calls[0].Body, `"text":"I've connected Oficina. Go ahead."`) { |
| - t.Fatalf("sends: %+v", calls) |
| - } |
| - home := strings.ReplaceAll(a.get("/").Body, "'", "'") |
| - if !strings.Contains(home, `<li class="msg person" data-id="`) || strings.Count(home, resumeText) != 1 { |
| - t.Fatalf("home lacks the person's line, once:\n%s", home) |
| - } |
| - if strings.Contains(home, "Oficina connected.") { |
| - t.Errorf("home says the note as well as going on") |
| - } |
| - if !strings.Contains(home, `<p class="ask-status" role="status">Thinking…</p>`) { |
| - t.Errorf("home does not show the Assistant at work") |
| - } |
| - a.get("/") |
| - // A second return with the same consent (a reload of the return |
| - // address that Equipo still took) sends under the same key: Equipo |
| - // keeps one message. |
| - a.get(doneURL(fakeState(), fakeCode())) |
| - if got := sends(f); len(got) > 2 || len(got) == 2 && got[0] != got[1] { |
| - t.Errorf("sent again: %v", got) |
| - } |
| - keys := map[string]bool{} |
| - for _, c := range f.Calls("/api/v1/assistant/messages") { |
| - keys[c.Header.Get("Idempotency-Key")] = true |
| - } |
| - if len(keys) != 1 { |
| - t.Errorf("the resumes went under %d keys", len(keys)) |
| - } |
| - if n := strings.Count(a.get("/ask/state").Body, "connected Oficina. Go ahead."); n != 1 { |
| - t.Errorf("the conversation has the person's line %d times", n) |
| - } |
| -} |
| - |
| -// Denied, cancelled, expired, unreachable, someone else's, or no code: |
| -// nothing is sent, and the chat says how it went. |
| -func TestOficinaDoneResumesOnlyWhenConnected(t *testing.T) { |
| - for _, finish := range []string{"denied", "expired", "unavailable", "surprise"} { |
| +// Base never sends anything for the person on returning from connecting |
| +// Oficina, however it went: Equipo goes on with the conversation itself |
| +// once the connect card resolves. |
| +func TestOficinaDoneSendsNothing(t *testing.T) { |
| + for _, finish := range []string{"connected", "denied", "expired", "unavailable", "surprise"} { |
| a, f := newAskApp(t) |
| a.connectEquipo(f) |
| f.FinishWith(finish) |
| a.get(doneURL(fakeState(), fakeCode())) |
| a.get("/") |
| + a.get("/") |
| if got := sends(f); len(got) != 0 { |
| t.Errorf("%s: sent %v", finish, got) |
| } |
| @@ -312,27 +265,11 @@ func TestOficinaDoneResumesOnlyWhenConnected(t *testing.T) { |
| a.get(target) |
| a.get("/") |
| } |
| - f.FailOficina(503, "unavailable") |
| - a.get(doneURL(fakeState(), fakeCode())) |
| if got := sends(f); len(got) != 0 { |
| t.Errorf("sent %v", got) |
| } |
| } |
| -// Connected, but the message could not go (no runner can answer): the |
| -// chat says it is connected, as before, and the person asks again. |
| -func TestOficinaDoneResumeFailsSaysConnected(t *testing.T) { |
| - a, f := newAskApp(t) |
| - a.connectEquipo(f) |
| - f.NoRunner() |
| - if r := a.get(doneURL(fakeState(), fakeCode())); r.Code != 303 || !strings.Contains(r.Header.Get("Set-Cookie"), "oficina_note=connected") { |
| - t.Fatalf("done: %d %v", r.Code, r.Header) |
| - } |
| - if home := a.get("/"); !strings.Contains(home.Body, "Oficina connected.") { |
| - t.Errorf("home lacks the note") |
| - } |
| -} |
| - |
| // The note sits in the conversation, after the line it follows (the reply |
| // that asked to connect), not under it: what comes later goes below it. |
| func TestOficinaNoteSitsInTheConversation(t *testing.T) { |