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" + }); + }); +});