Download packages/stats/core/src/r2-sql.test.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 807 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/stats/core/src/r2-sql.test.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/stats/core/src/r2-sql.test.ts
-
curl -L -o r2-sql.test.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/stats/core/src/r2-sql.test.ts
807 Bytes
| import { expect, test } from "bun:test" | |
| import { R2SqlQueryError } from "./r2-sql" | |
| test("includes the transport failure in the message used by sync logging", () => { | |
| const cause = new DOMException("The operation timed out.", "TimeoutError") | |
| const error = new R2SqlQueryError({ message: "Failed to run R2 SQL stats query", cause }) | |
| expect(error.message).toBe("Failed to run R2 SQL stats query: TimeoutError: The operation timed out.") | |
| expect(error.cause).toBe(cause) | |
| }) | |
| test("preserves an R2 response error and request details", () => { | |
| const error = new R2SqlQueryError({ message: "R2 SQL stats query failed", status: 400, requestId: "test-request" }) | |
| expect(error.message).toBe("R2 SQL stats query failed") | |
| expect(error.status).toBe(400) | |
| expect(error.requestId).toBe("test-request") | |
| }) | |