Compare commits

...

1 Commits

Author SHA1 Message Date
James Long d34d13ae2f test(core): simplify project copy layer wiring 2026-06-20 22:14:44 -04:00
+6 -13
View File
@@ -3,30 +3,23 @@ import { $ } from "bun"
import fs from "fs/promises" import fs from "fs/promises"
import path from "path" import path from "path"
import { eq } from "drizzle-orm" import { eq } from "drizzle-orm"
import { Effect, Fiber, Layer, Stream } from "effect" import { Effect, Fiber, Stream } from "effect"
import { AbsolutePath } from "@opencode-ai/core/schema" import { AbsolutePath } from "@opencode-ai/core/schema"
import { FSUtil } from "@opencode-ai/core/fs-util"
import { Git } from "@opencode-ai/core/git" import { Git } from "@opencode-ai/core/git"
import { Database } from "@opencode-ai/core/database/database" import { Database } from "@opencode-ai/core/database/database"
import { EventV2 } from "@opencode-ai/core/event" import { EventV2 } from "@opencode-ai/core/event"
import { LayerNode } from "@opencode-ai/core/effect/layer-node"
import { Project } from "@opencode-ai/core/project" import { Project } from "@opencode-ai/core/project"
import { ProjectDirectoryTable, ProjectTable } from "@opencode-ai/core/project/sql" import { ProjectDirectoryTable, ProjectTable } from "@opencode-ai/core/project/sql"
import { ProjectCopy } from "@opencode-ai/core/project/copy" import { ProjectCopy } from "@opencode-ai/core/project/copy"
import { ProjectDirectories } from "@opencode-ai/core/project/directories"
import { tmpdir } from "./fixture/tmpdir" import { tmpdir } from "./fixture/tmpdir"
import { testEffect } from "./lib/effect" import { testEffect } from "./lib/effect"
const databaseLayer = Database.layerFromPath(":memory:") const it = testEffect(
const eventLayer = EventV2.layer.pipe(Layer.provide(databaseLayer)) LayerNode.buildLayer(LayerNode.group([ProjectCopy.node, Database.node, EventV2.node]), {
const directoriesLayer = ProjectDirectories.layer.pipe(Layer.provide(databaseLayer)) replacements: [LayerNode.replace(Database.node, Database.layerFromPath(":memory:"))],
const copyLayer = ProjectCopy.layer.pipe( }),
Layer.provide(databaseLayer),
Layer.provide(directoriesLayer),
Layer.provide(eventLayer),
Layer.provide(FSUtil.defaultLayer),
Layer.provide(Git.defaultLayer),
) )
const it = testEffect(Layer.mergeAll(copyLayer, databaseLayer, eventLayer, directoriesLayer))
function abs(input: string) { function abs(input: string) {
return AbsolutePath.make(input) return AbsolutePath.make(input)