Skip to content

Commit a25c735

Browse files
update test
1 parent 4bee076 commit a25c735

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/get-scope.browser.test.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe("getClientScope", () => {
9696
});
9797
/**
9898
* Current fix for this test is only implemented inside `[email protected]`
99-
*
99+
*
100100
* TODO: After fix is ported into original createWatch of `effector` package in the 23.0.0 release, remove skip
101101
*/
102102
test.skip("watchers should re-run, if value is changed after server values injection", async () => {
@@ -161,28 +161,32 @@ describe("getClientScope", () => {
161161
});
162162

163163
test("should support custom serializers", async () => {
164-
const $homeDate = createStore<Date | null>(null, {
165-
serialize: {
166-
read: (dateStringOrNull) =>
167-
typeof dateStringOrNull === "string" ? new Date(dateStringOrNull) : null,
168-
write: (dateOrNull) => (dateOrNull ? dateOrNull.toISOString() : null),
169-
},
170-
sid: "test_sid",
164+
const $homeDate = createStore<Date | null>(null, {
165+
serialize: {
166+
read: (dateStringOrNull) =>
167+
typeof dateStringOrNull === "string"
168+
? new Date(dateStringOrNull)
169+
: null,
170+
write: (dateOrNull) => (dateOrNull ? dateOrNull.toISOString() : null),
171+
},
172+
sid: "test_sid",
171173
});
172174

173175
const serverScope = fork();
174176

175-
await allSettled($homeDate, {scope: serverScope, params: new Date(2024, 10, 3) });
177+
await allSettled($homeDate, {
178+
scope: serverScope,
179+
params: new Date(2024, 10, 3),
180+
});
176181

177182
const values = serialize(serverScope);
178183

179184
const scope = getScope(values);
180185

181186
const clientValue = scope.getState($homeDate);
182187

183-
console.log(clientValue);
184-
185188
expect(clientValue instanceof Date).toBe(true);
189+
expect(clientValue!.getTime()).toEqual(new Date(2024, 10, 3).getTime());
186190
});
187191
});
188192

0 commit comments

Comments
 (0)