Files
devplacepy/nodes/extension/test/popup.test.mjs
T
retoorandClaude Sonnet 5.5 02ab747cd0
DevPlace CI / test (push) Failing after 44m45s
Code Farm: per-plot auto-replant pause and crop-lock check; community sync and node work
Continuous Delivery could never be turned off once a crop was planted. Add a
one-shot per-plot "stop after harvest" flag (POST /game/plot/stop, Devii tool
game_plot_stop, game_plots.stop_after_harvest), cleared by the next plant,
autoreplant claim or Refactor. Autoreplant now also respects crop locks through
the shared _crop_lock predicate. Plan and measurements in happyplanting.md.

Also includes the pending community sync, node network and related work in the
tree; the full suite passed (4999) with all of it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 02:23:43 +02:00

21 lines
1.1 KiB
JavaScript

import test from "node:test";
import assert from "node:assert/strict";
import { describeState, displayLabel } from "../ui/popup.js";
test("a suspended state shows the end time in DD/MM/YYYY and says it retries", () => {
const text = describeState({ state: "suspended", suspendedUntil: "2026-03-05T10:07:00Z", detail: "x" });
assert.match(text, /^Suspended until \d{2}\/\d{2}\/2026 \d{2}:\d{2}, retrying automatically$/);
assert.equal(describeState({ state: "suspended", suspendedUntil: "" }), "Suspended, retrying automatically");
});
test("other states show detail then last error", () => {
assert.equal(describeState({ state: "online", detail: "ok", lastError: "e" }), "ok");
assert.equal(describeState({ state: "backoff", detail: "", lastError: "e" }), "e");
});
test("the server label is the authority and the local label is the fallback", () => {
assert.equal(displayLabel({ deviceLabel: "Server name" }, { label: "typed" }), "Server name");
assert.equal(displayLabel({ deviceLabel: "" }, { label: "typed" }), "typed");
assert.equal(displayLabel({}, { label: "typed" }), "typed");
});