Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/__tests__/Squawk.action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,19 @@

pendingSpy.mockRestore();
});

it("resolves functional updates correctly", async () => {
const store = createStore({
testProp: "initial"
});

const updateAction = store.action(() => {
// Returning a function that returns the updated state
return (() => ({ testProp: "updated" })) as any;

Check warning on line 39 in src/__tests__/Squawk.action.test.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
});

await updateAction();

expect(store.get().testProp).toBe("updated");
});
});
Loading