GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test(core): simplify registry regression fixtures · anomalyco/opencode@e43f58d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • core/test
      • fixture
        • location.ts
      • integration-replay.test.ts
      • mcp.test.ts
      • plugin.test.ts
      • plugin
        • promise.test.ts
      • reference.test.ts
      • state.test.ts
      • vcs.test.ts
    • server/test
      • event-feed.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/core/test/fixture/location.ts‎

Copy file name to clipboardExpand all lines: packages/core/test/fixture/location.ts
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@ export function location(ref: Location.Ref, input: { projectDirectory?: Absolute
1414
} satisfies Location.Interface
1515
}
1616

17+
export function locationLayer(ref: Location.Ref, input: { projectDirectory?: AbsolutePath; vcs?: Project.Vcs } = {}) {
18+
return Layer.succeed(Location.Service, Location.Service.of(location(ref, input)))
19+
}
20+
1721
export const tempLocationLayer = Layer.unwrap(
1822
Effect.acquireRelease(
1923
Effect.promise(() => tmpdir()),
2024
(tmp) => Effect.promise(() => tmp[Symbol.asyncDispose]()),
2125
).pipe(
2226
Effect.map((tmp) => {
2327
const ref = Location.Ref.make({ directory: AbsolutePath.make(tmp.path) })
24-
return Layer.succeed(Location.Service, Location.Service.of(location(ref)))
28+
return locationLayer(ref)
2529
}),
2630
),
2731
)
Collapse file

‎packages/core/test/integration-replay.test.ts‎

Copy file name to clipboardExpand all lines: packages/core/test/integration-replay.test.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe("Integration replay", () => {
5959
.complete({ integrationID, attemptID: attempt.attemptID, code: "dummy-code" })
6060
.pipe(Effect.exit)
6161

62-
expect(Exit.isFailure(exit) && Cause.hasDies(exit.cause)).toBe(true)
62+
expect(exit).toMatchObject(Exit.die(failure))
6363
expect(Exit.isFailure(exit) && Cause.squash(exit.cause)).toBe(failure)
6464
expect(yield* integrations.oauth.status({ integrationID, attemptID: attempt.attemptID })).toEqual({
6565
status: "failed",
Collapse file

‎packages/core/test/mcp.test.ts‎

Copy file name to clipboardExpand all lines: packages/core/test/mcp.test.ts
+12-17Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import { ExitCode, makeHandle, ProcessId } from "effect/unstable/process/ChildPr
5858
import { Image } from "@opencode-ai/core/image"
5959
import { testEffect } from "./lib/effect"
6060
import { imagePassthrough } from "./lib/image"
61-
import { location } from "./fixture/location"
61+
import { location, locationLayer } from "./fixture/location"
6262
import { hostEnvironmentLayer, recordingEnvironmentLayer } from "./fixture/environment"
6363
import { executeTool, toolDefinitions, toolIdentity, waitForCodeModeTool, waitForTool } from "./lib/tool"
6464

@@ -1386,22 +1386,17 @@ testEffect(Layer.empty).live("serializes MCP config restoration behind an in-fli
13861386
)
13871387
}),
13881388
)
1389+
const shutdownIt = testEffect(
1390+
AppNodeBuilder.build(
1391+
LayerNode.group([Bus.node, Integration.node, Credential.node, Form.node, Environment.node, Location.node]),
1392+
[
1393+
[Location.node, locationLayer({ directory: AbsolutePath.make(import.meta.dir) })],
1394+
[Environment.node, hostEnvironmentLayer],
1395+
],
1396+
),
1397+
)
13891398
;["active", "queued"].forEach((phase) =>
1390-
testEffect(
1391-
AppNodeBuilder.build(
1392-
LayerNode.group([Bus.node, Integration.node, Credential.node, Form.node, Environment.node, Location.node]),
1393-
[
1394-
[
1395-
Location.node,
1396-
Layer.succeed(
1397-
Location.Service,
1398-
Location.Service.of(location({ directory: AbsolutePath.make(import.meta.dir) })),
1399-
),
1400-
],
1401-
[Environment.node, hostEnvironmentLayer],
1402-
],
1403-
),
1404-
).effect(`discards ${phase} MCP notifications after its layer closes`, () =>
1399+
shutdownIt.effect(`discards ${phase} MCP notifications after its layer closes`, () =>
14051400
Effect.gen(function* () {
14061401
const bus = yield* Bus.Service
14071402
const entered = yield* Deferred.make<void>()
@@ -1413,7 +1408,7 @@ testEffect(Layer.empty).live("serializes MCP config restoration behind an in-fli
14131408
Effect.andThen(TestClock.adjust("500 millis")),
14141409
),
14151410
)
1416-
const context = yield* Layer.build(Mcp.layer()).pipe(Scope.provide(root))
1411+
const context = yield* Layer.buildWithScope(Mcp.layer(), root)
14171412
const service = Context.get(context, Mcp.Service)
14181413
const observed: string[] = []
14191414
let block = false
Collapse file

‎packages/core/test/plugin.test.ts‎

Copy file name to clipboardExpand all lines: packages/core/test/plugin.test.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe("Plugin", () => {
5555
}),
5656
)
5757

58-
it.effect("refreshes its own stored OAuth connection during plugin activation", () =>
58+
it.live("refreshes its own stored OAuth connection during plugin activation", () =>
5959
Effect.gen(function* () {
6060
const plugins = yield* Plugin.Service
6161
const credentials = yield* Credential.Service
Collapse file

‎packages/core/test/plugin/promise.test.ts‎

Copy file name to clipboardExpand all lines: packages/core/test/plugin/promise.test.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { host as testHost } from "./host"
3232
const it = testEffect(PluginTestLayer)
3333

3434
describe("fromPromise", () => {
35-
it.effect("refreshes its own stored OAuth connection during plugin activation", () =>
35+
it.live("refreshes its own stored OAuth connection during plugin activation", () =>
3636
Effect.gen(function* () {
3737
const plugins = yield* Plugin.Service
3838
const credentials = yield* Credential.Service
Collapse file

‎packages/core/test/reference.test.ts‎

Copy file name to clipboardExpand all lines: packages/core/test/reference.test.ts
+13-11Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ import { Global } from "@opencode-ai/util/global"
99
import { Reference } from "@opencode-ai/core/reference"
1010
import { Repository } from "@opencode-ai/core/repository"
1111
import { RepositoryCache } from "@opencode-ai/core/repository-cache"
12-
import { it } from "./lib/effect"
12+
import { it, testEffect } from "./lib/effect"
1313

1414
const cache = Layer.mock(RepositoryCache.Service, {
1515
ensure: () => Effect.die("unexpected Git materialization"),
1616
})
1717
const referenceLayer = AppNodeBuilder.build(LayerNode.group([Reference.node, Bus.node]), [
1818
[RepositoryCache.node, cache],
1919
])
20+
const referenceIt = testEffect(referenceLayer)
2021

2122
describe("Reference", () => {
2223
it.effect("prepares batched references before cache work or update events", () => {
@@ -95,10 +96,10 @@ describe("Reference", () => {
9596
refresh: input.refresh,
9697
})),
9798
).toEqual([{ repository: "owner/repo", branch: "feature/docs", refresh: true }])
98-
}).pipe(Effect.provide(referenceLayer))
99+
}).pipe(Effect.scoped, Effect.provide(referenceLayer))
99100
})
100101

101-
it.effect("lets update listeners replace references and refetch the latest projection", () =>
102+
referenceIt.effect("lets update listeners replace references and refetch the latest projection", () =>
102103
Effect.gen(function* () {
103104
const references = yield* Reference.Service
104105
const bus = yield* Bus.Service
@@ -133,13 +134,14 @@ describe("Reference", () => {
133134

134135
expect((yield* references.list()).map((info) => info.path)).toEqual([AbsolutePath.make("/new")])
135136
expect(observed).toEqual([["/new"], ["/new"]])
136-
}).pipe(Effect.provide(referenceLayer)),
137+
}),
137138
)
138139

139-
it.effect("registers normalized sources for the owning scope", () =>
140+
referenceIt.effect("registers normalized sources for the owning scope", () =>
140141
Effect.gen(function* () {
141142
const references = yield* Reference.Service
142-
const scope = yield* Scope.make()
143+
const parent = yield* Effect.scope
144+
const scope = yield* Scope.fork(parent)
143145
const path = AbsolutePath.make("/docs")
144146
const source = Reference.LocalSource.make({
145147
type: "local",
@@ -155,10 +157,10 @@ describe("Reference", () => {
155157

156158
yield* Scope.close(scope, Exit.void)
157159
expect(yield* references.list()).toEqual([])
158-
}).pipe(Effect.provide(referenceLayer)),
160+
}),
159161
)
160162

161-
it.effect("derives Git paths without exposing cache operations", () =>
163+
referenceIt.effect("derives Git paths without exposing cache operations", () =>
162164
Effect.gen(function* () {
163165
const references = yield* Reference.Service
164166
const repository = Repository.parseRemote("owner/repo")
@@ -172,10 +174,10 @@ describe("Reference", () => {
172174
source,
173175
}),
174176
])
175-
}).pipe(Effect.scoped, Effect.provide(referenceLayer)),
177+
}),
176178
)
177179

178-
it.effect("preserves configured Git descriptions", () =>
180+
referenceIt.effect("preserves configured Git descriptions", () =>
179181
Effect.gen(function* () {
180182
const references = yield* Reference.Service
181183
const repository = Repository.parseRemote("owner/repo")
@@ -194,6 +196,6 @@ describe("Reference", () => {
194196
source,
195197
}),
196198
])
197-
}).pipe(Effect.scoped, Effect.provide(referenceLayer)),
199+
}),
198200
)
199201
})

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.