|
|
@@ -0,0 +1,39 @@
|
|
|
+import { describe, expect, test } from "bun:test"
|
|
|
+import { createRoot, getOwner } from "solid-js"
|
|
|
+import { createStore } from "solid-js/store"
|
|
|
+import type { State } from "./types"
|
|
|
+import { createChildStoreManager } from "./child-store"
|
|
|
+
|
|
|
+const child = () => createStore({} as State)
|
|
|
+
|
|
|
+describe("createChildStoreManager", () => {
|
|
|
+ test("does not evict the active directory during mark", () => {
|
|
|
+ const owner = createRoot((dispose) => {
|
|
|
+ const current = getOwner()
|
|
|
+ dispose()
|
|
|
+ return current
|
|
|
+ })
|
|
|
+ if (!owner) throw new Error("owner required")
|
|
|
+
|
|
|
+ const manager = createChildStoreManager({
|
|
|
+ owner,
|
|
|
+ markStats() {},
|
|
|
+ incrementEvictions() {},
|
|
|
+ isBooting: () => false,
|
|
|
+ isLoadingSessions: () => false,
|
|
|
+ onBootstrap() {},
|
|
|
+ onDispose() {},
|
|
|
+ })
|
|
|
+
|
|
|
+ Array.from({ length: 30 }, (_, index) => `/pinned-${index}`).forEach((directory) => {
|
|
|
+ manager.children[directory] = child()
|
|
|
+ manager.pin(directory)
|
|
|
+ })
|
|
|
+
|
|
|
+ const directory = "/active"
|
|
|
+ manager.children[directory] = child()
|
|
|
+ manager.mark(directory)
|
|
|
+
|
|
|
+ expect(manager.children[directory]).toBeDefined()
|
|
|
+ })
|
|
|
+})
|