|
7 | 7 | mergeSearchString, |
8 | 8 | extractSearchParams |
9 | 9 | } from "../src/utils.js"; |
| 10 | +import { createRoot } from "solid-js"; |
10 | 11 |
|
11 | 12 | describe("resolvePath should", () => { |
12 | 13 | test("normalize the base arg", () => { |
@@ -355,38 +356,44 @@ describe("joinPaths should", () => { |
355 | 356 |
|
356 | 357 | describe("createMemoObject should", () => { |
357 | 358 | test("allow listing its own keys", () => { |
358 | | - const actual = createMemoObject(() => ({ |
359 | | - hello: "world", |
360 | | - get throws() { |
361 | | - throw new Error("throws"); |
362 | | - } |
363 | | - })); |
364 | | - expect(Object.getOwnPropertyNames(actual)).toEqual(["hello", "throws"]); |
| 359 | + createRoot(() => { |
| 360 | + const actual = createMemoObject(() => ({ |
| 361 | + hello: "world", |
| 362 | + get throws() { |
| 363 | + throw new Error("throws"); |
| 364 | + } |
| 365 | + })); |
| 366 | + expect(Object.getOwnPropertyNames(actual)).toEqual(["hello", "throws"]); |
| 367 | + }); |
365 | 368 | }); |
366 | 369 |
|
367 | 370 | test("allow listing its keys", () => { |
368 | | - const actual = createMemoObject(() => ({ |
369 | | - hello: "world", |
370 | | - get throws() { |
371 | | - throw new Error("throws"); |
372 | | - } |
373 | | - })); |
374 | | - expect(Object.keys(actual)).toEqual(["hello", "throws"]); |
| 371 | + createRoot(() => { |
| 372 | + const actual = createMemoObject(() => ({ |
| 373 | + hello: "world", |
| 374 | + get throws() { |
| 375 | + throw new Error("throws"); |
| 376 | + } |
| 377 | + })); |
| 378 | + expect(Object.keys(actual)).toEqual(["hello", "throws"]); |
| 379 | + }); |
375 | 380 | }); |
376 | 381 |
|
377 | 382 | test("stringify into JSON", () => { |
378 | | - const actual = createMemoObject(() => ({ |
379 | | - hello: "world", |
380 | | - get getter() { |
381 | | - return "works too"; |
382 | | - } |
383 | | - })); |
384 | | - expect(JSON.stringify(actual)).toEqual( |
385 | | - JSON.stringify({ |
| 383 | + createRoot(() => { |
| 384 | + const actual = createMemoObject(() => ({ |
386 | 385 | hello: "world", |
387 | | - getter: "works too" |
388 | | - }) |
389 | | - ); |
| 386 | + get getter() { |
| 387 | + return "works too"; |
| 388 | + } |
| 389 | + })); |
| 390 | + expect(JSON.stringify(actual)).toEqual( |
| 391 | + JSON.stringify({ |
| 392 | + hello: "world", |
| 393 | + getter: "works too" |
| 394 | + }) |
| 395 | + ); |
| 396 | + }); |
390 | 397 | }); |
391 | 398 | }); |
392 | 399 |
|
|
0 commit comments