Download packages/app/src/context/global-sync/queue.test.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/SaylorTwift/opencode/resolve/eb1202c08d0fcc3e89b18b16bcc802e692e97016/packages/app/src/context/global-sync/queue.test.ts
- Command line
-
hf download hf://SaylorTwift/opencode@eb1202c08d0fcc3e89b18b16bcc802e692e97016/packages/app/src/context/global-sync/queue.test.ts
-
curl -L -o queue.test.ts https://huggingface.co/SaylorTwift/opencode/resolve/eb1202c08d0fcc3e89b18b16bcc802e692e97016/packages/app/src/context/global-sync/queue.test.ts
1.14 kB
| import { describe, expect, test } from "bun:test" | |
| import { createRefreshQueue } from "./queue" | |
| import { directoryKey } from "./utils" | |
| const tick = () => new Promise((resolve) => setTimeout(resolve, 10)) | |
| describe("createRefreshQueue", () => { | |
| test("clears queued directories by normalized key", async () => { | |
| const calls: string[] = [] | |
| const queue = createRefreshQueue({ | |
| paused: () => false, | |
| key: directoryKey, | |
| bootstrap: async () => {}, | |
| bootstrapInstance: (directory) => { | |
| calls.push(directory) | |
| }, | |
| }) | |
| queue.push("C:\\tmp\\demo") | |
| queue.clear("C:/tmp/demo") | |
| await tick() | |
| expect(calls).toEqual([]) | |
| queue.dispose() | |
| }) | |
| test("passes the original directory to bootstrapInstance", async () => { | |
| const calls: string[] = [] | |
| const queue = createRefreshQueue({ | |
| paused: () => false, | |
| key: directoryKey, | |
| bootstrap: async () => {}, | |
| bootstrapInstance: (directory) => { | |
| calls.push(directory) | |
| }, | |
| }) | |
| queue.push("C:\\tmp\\demo") | |
| await tick() | |
| expect(calls).toEqual(["C:\\tmp\\demo"]) | |
| queue.dispose() | |
| }) | |
| }) | |