From 89e5f6666c4ff811598710fb18a473625772f7d6 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 12:21:06 +0000 Subject: [PATCH] test: add unit tests for store update method Added `src/__tests__/Squawk.update.test.ts` to cover the `update()` method of the `createdStore` in `Squawk.ts`. The new tests check that `update` correctly applies partial updates to single and multiple state properties without modifying unrelated properties. Co-authored-by: johnstrand <11484777+johnstrand@users.noreply.github.com> --- src/__tests__/Squawk.update.test.ts | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/__tests__/Squawk.update.test.ts diff --git a/src/__tests__/Squawk.update.test.ts b/src/__tests__/Squawk.update.test.ts new file mode 100644 index 0000000..ced1a93 --- /dev/null +++ b/src/__tests__/Squawk.update.test.ts @@ -0,0 +1,31 @@ +import createStore from "../Squawk"; + +describe("Squawk update", () => { + it("updates partial state correctly", () => { + const store = createStore({ + prop1: "initial1", + prop2: "initial2" + }); + + store.update({ prop1: "updated1" }); + + expect(store.get()).toEqual({ + prop1: "updated1", + prop2: "initial2" + }); + }); + + it("updates multiple properties correctly", () => { + const store = createStore({ + prop1: "initial1", + prop2: "initial2" + }); + + store.update({ prop1: "updated1", prop2: "updated2" }); + + expect(store.get()).toEqual({ + prop1: "updated1", + prop2: "updated2" + }); + }); +});