Add tests for null no-change and zero as real value

This commit is contained in:
2026-04-26 09:35:53 -07:00
parent acf5e74f30
commit 81e08afa00
+12
View File
@@ -45,3 +45,15 @@ test('mergeState does not mutate inputs', () => {
assert.deepEqual(current, before); assert.deepEqual(current, before);
assert.deepEqual(update, { title: 'X' }); 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);
});