web: live run updates over a single app-wide watch (R10)
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
ForegroundAction,
|
||||
IDLE_BANNER_TEXT,
|
||||
RETRYING_SUFFIX,
|
||||
RunStream,
|
||||
bannerState,
|
||||
foregroundAction,
|
||||
liveBadgeState,
|
||||
@@ -182,19 +183,14 @@ test("serverBuildLabel tolerates missing fields", () => {
|
||||
// liveBadgeState — RunStream.kt words
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test("liveBadgeState is live only while executing on a connected socket", () => {
|
||||
assert.deepEqual(liveBadgeState({ executing: true }, { kind: "connected" }), { tone: "live", label: "live" });
|
||||
assert.deepEqual(liveBadgeState({ executing: true }, { kind: "disconnected" }), {
|
||||
tone: "reconnecting",
|
||||
label: "reconnecting",
|
||||
});
|
||||
assert.deepEqual(liveBadgeState({ executing: true }, { kind: "connecting" }), {
|
||||
tone: "reconnecting",
|
||||
label: "reconnecting",
|
||||
});
|
||||
assert.deepEqual(liveBadgeState({ executing: false }, { kind: "connected" }), { tone: "not-live", label: "not live" });
|
||||
assert.deepEqual(liveBadgeState(null, { kind: "connected" }), { tone: "not-live", label: "not live" });
|
||||
assert.deepEqual(liveBadgeState({ executing: true }, { kind: "idle" }), { tone: "not-live", label: "not live" });
|
||||
test("liveBadgeState maps the explicit stream state to RunStream.kt's words", () => {
|
||||
// The badge says whether pushes are arriving, independent of any executing run.
|
||||
assert.deepEqual(liveBadgeState(RunStream.Live), { tone: "live", label: "live" });
|
||||
assert.deepEqual(liveBadgeState(RunStream.Connecting), { tone: "reconnecting", label: "reconnecting" });
|
||||
assert.deepEqual(liveBadgeState(RunStream.Offline), { tone: "not-live", label: "not live" });
|
||||
// An unknown/missing state is honestly not live.
|
||||
assert.deepEqual(liveBadgeState(undefined), { tone: "not-live", label: "not live" });
|
||||
assert.deepEqual(liveBadgeState("something-else"), { tone: "not-live", label: "not live" });
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user