[schema] CareEvent: Water carries the amount poured, so watering by feel can be replayed

This commit is contained in:
2026-11-02 00:20:56 +01:00
parent 5e41a449a4
commit b150c64af7
2 changed files with 97 additions and 12 deletions
+12 -2
View File
@@ -10,7 +10,7 @@ const careEvent = {
localDay: '2026-10-24',
from: KEY_A,
to: KEY_B,
act: 'water',
act: 'shade',
trace: 'petal:pale-pink',
messageId: 'ps-23-4',
clientVersion: '0.1.0'
@@ -64,9 +64,19 @@ describe('hope sentence', () => {
describe('care event', () => {
it('accepts every act the rose has', () => {
for (const act of ['water', 'shade', 'weed', 'petals']) {
for (const act of ['shade', 'weed', 'petals']) {
expect(validateCareEvent({ ...careEvent, act }), act).toMatchObject({ ok: true });
}
expect(validateCareEvent({ ...careEvent, act: 'water', amount: 0.5 })).toMatchObject({ ok: true });
});
it('water carries how much was poured, 0 to 1; no other act carries it (rose.md R1)', () => {
expect(validateCareEvent({ ...careEvent, act: 'water' }).ok, 'water without amount').toBe(false);
expect(validateCareEvent({ ...careEvent, act: 'water', amount: 0 }).ok).toBe(true);
expect(validateCareEvent({ ...careEvent, act: 'water', amount: 1 }).ok).toBe(true);
expect(validateCareEvent({ ...careEvent, act: 'water', amount: 1.01 }).ok).toBe(false);
expect(validateCareEvent({ ...careEvent, act: 'water', amount: -0.1 }).ok).toBe(false);
expect(validateCareEvent({ ...careEvent, act: 'weed', amount: 0.5 }).ok, 'weeds are pulled, not poured').toBe(false);
});
it('rejects the acts §6.2 used to list by mistake', () => {