From 81e08afa0094db3b1ba355ffd4832f4884074908 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Sun, 26 Apr 2026 09:35:53 -0700 Subject: [PATCH] Add tests for null no-change and zero as real value --- desktop-client/tests/state.test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/desktop-client/tests/state.test.js b/desktop-client/tests/state.test.js index 9c9f3b6..408153f 100644 --- a/desktop-client/tests/state.test.js +++ b/desktop-client/tests/state.test.js @@ -45,3 +45,15 @@ test('mergeState does not mutate inputs', () => { assert.deepEqual(current, before); assert.deepEqual(update, { title: 'X' }); }); + +test('mergeState treats null fields as no-change', () => { + const current = { ...initialState, title: 'Previous' }; + const next = mergeState(current, { title: null }); + assert.equal(next.title, 'Previous'); +}); + +test('mergeState applies 0 as a real value (not a no-change)', () => { + const current = { ...initialState, progress: 42 }; + const next = mergeState(current, { progress: 0 }); + assert.equal(next.progress, 0); +});