Record planting day and show harvest dates

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-06 10:07:21 +01:00
parent 07057e6c3d
commit 83a9cb6dcc
11 changed files with 282 additions and 44 deletions

View file

@ -28,3 +28,18 @@ assert.equal(confirmed.checks["crop-parsnip"], true);
assert.equal(confirmed.revision, 7);
console.log("sync race tests passed");
// Plantings follow the same rules: an in-flight local planting (or removal) wins.
const springFive = { year: 1, season: "spring", day: 5 };
const plantMerge = sync.mergeSnapshot({}, new Set(), 7, {
revision: 8,
checks: {},
plantings: { "crop-parsnip": { year: 1, season: "spring", day: 1 }, "crop-potato": springFive }
}, { "crop-parsnip": springFive }, new Set(["crop-parsnip", "crop-potato"]));
assert.deepEqual(plantMerge.plantings, { "crop-parsnip": springFive });
const unplanted = sync.confirmPlanting(plantMerge.plantings, 8, { itemId: "crop-parsnip", planted: null, revision: 9 });
assert.deepEqual(unplanted.plantings, {});
assert.equal(unplanted.revision, 9);
console.log("planting sync tests passed");