Qoder's plugin 0.2.32 (magpie-community/plugins 74be632) says why no check-in was offered: it asked with this machine's own device identity and Qoder offered no campaign, and Qoder desktop can claim one it shows. magpie dropped a hook's message for inactive and ineligible and showed only "No check-in event now". Now: - GUI: the Usage card's row reads "<label> · <message>", wrapped under the label rather than cut off with "…" (data-why, as a failed row's reason wraps, #821); Settings' check-in line under the plugin's switch carries it too. A result without a message reads as before. No new i18n keys: the message is the plugin's own text, as for failed rows. - TUI: the Usage cell is too narrow, so it adds "c says why"; c's flash carries the message (checkinWhy). - CLI: `magpie accounts checkin` prints it after the label. - The Qoder mover's min is 0.2.32 (npm view --prefer-online: 0.2.32). - docs/subsystems/provider-plugins.md says how the message is shown. Run at this tree (based on origin/maindd1e8822d): - go test -timeout 45m ./... (tee'd, grepped): every package ok but internal/handoff, whose TestTakeOnlyAFreshOfferForThisProgram could not bind a unix socket under my long scratch TMPDIR (path over 104 bytes); with the default TMPDIR internal/handoff is ok. - gofmt -l: clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean. - GUI, chromium and webkit: checkin-reason (new: en, zh, zh-TW, ja, de; 900 and 440px), plugin-checkin, qoder-checkin-recheck, usage-checkin, checkin-account, checkin-early-done, usage-quota-head, i18n-keys: 155/157. The 2 reds are usage-checkin's "webkit en/zh: Settings has a Qoder check-in tab", red the same on a fresh origin/maina9a001a7a(#2549, #3091). - TestCoreScriptBudget: app.js 1,343,313 of 1,343,324, no raise. Rebased on origin/main4683a0382(a9a001a7a's app.js line, 4683a0382's provider change) and run again at this head: internal/gui (budget: 1,343,323 of 1,343,324), internal/cli, internal/tui and the whole internal/provider ok; the same 8 GUI files in both engines, 155/157, the same two #2549/#3091 reds. Broken by hand: app.js's change reverted, checkin-reason goes red on the reason; app.css's reverted, red on the wrap; checkinWhy returning "" in internal/cli and internal/tui, TestCheckinSaysWhyNoneWasOffered red in each. Not tried: a real Qoder account offered no campaign (the fixture is the plugin's own text); the real Linux app (WebKitGTK).
42 lines
1.6 KiB
Go
42 lines
1.6 KiB
Go
package tui
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/yetone/magpie/internal/provider"
|
|
)
|
|
|
|
// plugins#304: an inactive or ineligible check-in says the plugin's (or
|
|
// vendor's) reason after c, and its account line points to c for it; one
|
|
// without a reason reads as before.
|
|
func TestCheckinSaysWhyNoneWasOffered(t *testing.T) {
|
|
const why = "Qoder check-in: Qoder offered this device's identity no daily credits campaign right now"
|
|
now := time.Date(2026, 10, 24, 15, 0, 0, 0, time.FixedZone("CST", 8*3600))
|
|
day := provider.CheckinDay(now)
|
|
r := provider.WorkBuddyCheckin{User: "arno", By: "plugin:qoder", Vendor: "Qoder", Day: day, Outcome: provider.CheckinInactive, Msg: why}
|
|
if w := checkinWords(r); w != "Qoder arno: no check-in event now · "+why {
|
|
t.Errorf("inactive: %q", w)
|
|
}
|
|
if c := checkinCell(provider.SubscriptionQuota{Checkins: true, Checkin: &r}, now); !strings.Contains(c, "no event now · c says why") {
|
|
t.Errorf("inactive cell: %q", c)
|
|
}
|
|
n := provider.WorkBuddyCheckin{User: "lei", By: "trae", Day: day, Outcome: provider.CheckinIneligible, Msg: "this device has checked in today"}
|
|
if w := checkinWords(n); w != "Trae CN lei isn't eligible for the check-in · this device has checked in today" {
|
|
t.Errorf("ineligible: %q", w)
|
|
}
|
|
a := r
|
|
a.Again = true
|
|
if w := checkinWords(a); !strings.HasSuffix(w, "magpie asks again later · "+why) {
|
|
t.Errorf("again: %q", w)
|
|
}
|
|
r.Msg = ""
|
|
if w := checkinWords(r); w != "Qoder arno: no check-in event now" {
|
|
t.Errorf("no reason: %q", w)
|
|
}
|
|
if c := checkinCell(provider.SubscriptionQuota{Checkins: true, Checkin: &r}, now); strings.Contains(c, "why") {
|
|
t.Errorf("no reason cell: %q", c)
|
|
}
|
|
}
|