refactor(opencode): roll out serviceUse proxy across 14 services + tests (#28576)
This commit is contained in:
@@ -28,7 +28,7 @@ const it = testEffect(
|
||||
|
||||
const withSession = (input?: Parameters<SessionNs.Interface["create"]>[0]) =>
|
||||
Effect.acquireRelease(
|
||||
SessionNs.Service.use((session) => session.create(input)),
|
||||
SessionNs.use.create(input),
|
||||
(created) => SessionNs.Service.use((session) => session.remove(created.id).pipe(Effect.ignore)),
|
||||
)
|
||||
|
||||
@@ -56,7 +56,7 @@ describe("session.list", () => {
|
||||
provideInstance(path.join(test.directory, "packages", "app")),
|
||||
)
|
||||
|
||||
const ids = (yield* SessionNs.Service.use((session) => session.list())).map((session) => session.id)
|
||||
const ids = (yield* SessionNs.use.list()).map((session) => session.id)
|
||||
expect(ids).toContain(root.id)
|
||||
expect(ids).toContain(parent.id)
|
||||
expect(ids).toContain(current.id)
|
||||
@@ -179,7 +179,7 @@ describe("session.list", () => {
|
||||
const root = yield* withSession({ title: "root-session" })
|
||||
const child = yield* withSession({ title: "child-session", parentID: root.id })
|
||||
|
||||
const sessions = yield* SessionNs.Service.use((session) => session.list({ roots: true }))
|
||||
const sessions = yield* SessionNs.use.list({ roots: true })
|
||||
const ids = sessions.map((session) => session.id)
|
||||
|
||||
expect(ids).toContain(root.id)
|
||||
@@ -206,7 +206,7 @@ describe("session.list", () => {
|
||||
yield* withSession({ title: "unique-search-term-abc" })
|
||||
yield* withSession({ title: "other-session-xyz" })
|
||||
|
||||
const sessions = yield* SessionNs.Service.use((session) => session.list({ search: "unique-search" }))
|
||||
const sessions = yield* SessionNs.use.list({ search: "unique-search" })
|
||||
const titles = sessions.map((session) => session.title)
|
||||
|
||||
expect(titles).toContain("unique-search-term-abc")
|
||||
@@ -223,7 +223,7 @@ describe("session.list", () => {
|
||||
yield* withSession({ title: "session-2" })
|
||||
yield* withSession({ title: "session-3" })
|
||||
|
||||
const sessions = yield* SessionNs.Service.use((session) => session.list({ limit: 2 }))
|
||||
const sessions = yield* SessionNs.use.list({ limit: 2 })
|
||||
expect(sessions.length).toBe(2)
|
||||
}),
|
||||
{ git: true },
|
||||
|
||||
Reference in New Issue
Block a user