refactor(server): serve raw filesystem content (#31911)
This commit is contained in:
parent
31b233e9db
commit
31c5454ee6
12 changed files with 67 additions and 93 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import fs from "fs/promises"
|
||||
import path from "path"
|
||||
import { fileURLToPath } from "url"
|
||||
import { describe, expect } from "bun:test"
|
||||
import { Effect, Exit, Layer } from "effect"
|
||||
import { FileSystem } from "@opencode-ai/core/filesystem"
|
||||
|
|
@ -40,9 +39,9 @@ describe("FileSystem", () => {
|
|||
const service = yield* FileSystem.Service
|
||||
const text = yield* service.read({ path: RelativePath.make("text.txt") })
|
||||
const binary = yield* service.read({ path: RelativePath.make("data.bin") })
|
||||
expect(text).toMatchObject({ name: "text.txt", content: "hello", encoding: "utf8", mime: "text/plain" })
|
||||
expect(fileURLToPath(text.uri)).toBe(path.join(directory, "text.txt"))
|
||||
expect(binary).toMatchObject({ name: "data.bin", content: "AAEC", encoding: "base64" })
|
||||
expect(new TextDecoder().decode(text.content)).toBe("hello")
|
||||
expect(text.mime).toBe("text/plain")
|
||||
expect(binary.content).toEqual(new Uint8Array([0, 1, 2]))
|
||||
}).pipe(provide(directory)),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue