diff --git a/packages/opencode/test/agent/plugin-agent-regression.test.ts b/packages/opencode/test/agent/plugin-agent-regression.test.ts index 1bb46701d3..bf54e929d0 100644 --- a/packages/opencode/test/agent/plugin-agent-regression.test.ts +++ b/packages/opencode/test/agent/plugin-agent-regression.test.ts @@ -1,6 +1,5 @@ import { expect } from "bun:test" import { AppFileSystem } from "@opencode-ai/core/filesystem" -import { AuthWellKnown } from "@opencode-ai/core/auth-well-known" import { Substitution } from "@opencode-ai/core/substitution" import { Effect, Layer } from "effect" import path from "path" @@ -13,6 +12,7 @@ import { RuntimeFlags } from "../../src/effect/runtime-flags" import { Plugin } from "../../src/plugin" import { AccountTest } from "../fake/account" import { AuthTest } from "../fake/auth" +import { AuthWellKnownTest } from "../fake/auth-well-known" import { NpmTest } from "../fake/npm" import { ProviderTest } from "../fake/provider" import { SkillTest } from "../fake/skill" @@ -25,12 +25,9 @@ import { PLUGIN_AGENT } from "../fixture/agent-plugin.constants" const pluginUrl = pathToFileURL(path.join(import.meta.dir, "..", "fixture", "agent-plugin.ts")).href const provider = ProviderTest.fake() -const emptyAuthWellKnown = Layer.mock(AuthWellKnown.Service)({ - configs: () => Effect.succeed([]), -}) const configLayer = Config.layer.pipe( Layer.provide(AppFileSystem.defaultLayer), - Layer.provide(emptyAuthWellKnown), + Layer.provide(AuthWellKnownTest.empty), Layer.provide(Substitution.defaultLayer), Layer.provide(Env.defaultLayer), Layer.provide(AuthTest.empty), diff --git a/packages/opencode/test/config/config.test.ts b/packages/opencode/test/config/config.test.ts index 064b393490..7aeddf534a 100644 --- a/packages/opencode/test/config/config.test.ts +++ b/packages/opencode/test/config/config.test.ts @@ -32,16 +32,13 @@ import { Filesystem } from "@/util/filesystem" import { ConfigPlugin } from "@/config/plugin" import { Npm } from "@opencode-ai/core/npm" import { Substitution } from "@opencode-ai/core/substitution" +import { AuthWellKnownTest } from "../fake/auth-well-known" const emptyAccount = Layer.mock(Account.Service)({ active: () => Effect.succeed(Option.none()), activeOrg: () => Effect.succeed(Option.none()), }) -const emptyAuthWellKnown = Layer.mock(AuthWellKnown.Service)({ - configs: () => Effect.succeed([]), -}) - const testFlock = EffectFlock.defaultLayer const noopNpm = Layer.mock(Npm.Service)({ @@ -58,7 +55,7 @@ const layer = Config.layer.pipe( Layer.provide(AppFileSystem.defaultLayer), Layer.provide(Substitution.defaultLayer), Layer.provide(Env.defaultLayer), - Layer.provide(emptyAuthWellKnown), + Layer.provide(AuthWellKnownTest.empty), Layer.provide(emptyAccount), Layer.provideMerge(infra), Layer.provide(noopNpm), @@ -595,7 +592,7 @@ test("resolves env templates in account config with account token", async () => Layer.provide(AppFileSystem.defaultLayer), Layer.provide(Substitution.defaultLayer), Layer.provide(Env.defaultLayer), - Layer.provide(emptyAuthWellKnown), + Layer.provide(AuthWellKnownTest.empty), Layer.provide(fakeAccount), Layer.provideMerge(infra), Layer.provide(noopNpm), @@ -1107,7 +1104,7 @@ test("installs dependencies in writable OPENCODE_CONFIG_DIR", async () => { Layer.provide(AppFileSystem.defaultLayer), Layer.provide(Substitution.defaultLayer), Layer.provide(Env.defaultLayer), - Layer.provide(emptyAuthWellKnown), + Layer.provide(AuthWellKnownTest.empty), Layer.provide(emptyAccount), Layer.provideMerge(infra), Layer.provide(noopNpm), diff --git a/packages/opencode/test/fake/auth-well-known.ts b/packages/opencode/test/fake/auth-well-known.ts new file mode 100644 index 0000000000..5a9f13dccd --- /dev/null +++ b/packages/opencode/test/fake/auth-well-known.ts @@ -0,0 +1,8 @@ +import { AuthWellKnown } from "@opencode-ai/core/auth-well-known" +import { Effect, Layer } from "effect" + +export const AuthWellKnownTest = { + empty: Layer.mock(AuthWellKnown.Service, { + configs: () => Effect.succeed([]), + }), +} diff --git a/packages/opencode/test/plugin/trigger.test.ts b/packages/opencode/test/plugin/trigger.test.ts index 9196754e4f..77b8417a20 100644 --- a/packages/opencode/test/plugin/trigger.test.ts +++ b/packages/opencode/test/plugin/trigger.test.ts @@ -3,7 +3,6 @@ import { Effect, Layer, Option } from "effect" import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner" import { AppFileSystem } from "@opencode-ai/core/filesystem" import { EffectFlock } from "@opencode-ai/core/util/effect-flock" -import { AuthWellKnown } from "@opencode-ai/core/auth-well-known" import { Substitution } from "@opencode-ai/core/substitution" import path from "path" import { pathToFileURL } from "url" @@ -18,6 +17,7 @@ import { ModelID, ProviderID } from "../../src/provider/schema" import { provideTmpdirInstance } from "../fixture/fixture" import { testEffect } from "../lib/effect" import { NpmTest } from "../fake/npm" +import { AuthWellKnownTest } from "../fake/auth-well-known" const emptyAccount = Layer.mock(Account.Service)({ active: () => Effect.succeed(Option.none()), @@ -26,13 +26,10 @@ const emptyAccount = Layer.mock(Account.Service)({ const emptyAuth = Layer.mock(Auth.Service)({ all: () => Effect.succeed({}), }) -const emptyAuthWellKnown = Layer.mock(AuthWellKnown.Service)({ - configs: () => Effect.succeed([]), -}) const configLayer = Config.layer.pipe( Layer.provide(EffectFlock.defaultLayer), Layer.provide(AppFileSystem.defaultLayer), - Layer.provide(emptyAuthWellKnown), + Layer.provide(AuthWellKnownTest.empty), Layer.provide(Substitution.defaultLayer), Layer.provide(Env.defaultLayer), Layer.provide(emptyAuth), diff --git a/packages/opencode/test/plugin/workspace-adapter.test.ts b/packages/opencode/test/plugin/workspace-adapter.test.ts index 0871a1079d..0dfbf53757 100644 --- a/packages/opencode/test/plugin/workspace-adapter.test.ts +++ b/packages/opencode/test/plugin/workspace-adapter.test.ts @@ -4,7 +4,6 @@ import { FetchHttpClient } from "effect/unstable/http" import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner" import { AppFileSystem } from "@opencode-ai/core/filesystem" import { EffectFlock } from "@opencode-ai/core/util/effect-flock" -import { AuthWellKnown } from "@opencode-ai/core/auth-well-known" import { Substitution } from "@opencode-ai/core/substitution" import path from "path" import { pathToFileURL } from "url" @@ -27,6 +26,7 @@ import { SyncEvent } from "../../src/sync" import { disposeAllInstances, provideTmpdirInstance } from "../fixture/fixture" import { testEffect } from "../lib/effect" import { NpmTest } from "../fake/npm" +import { AuthWellKnownTest } from "../fake/auth-well-known" const emptyAccount = Layer.mock(Account.Service)({ active: () => Effect.succeed(Option.none()), @@ -35,13 +35,10 @@ const emptyAccount = Layer.mock(Account.Service)({ const emptyAuth = Layer.mock(Auth.Service)({ all: () => Effect.succeed({}), }) -const emptyAuthWellKnown = Layer.mock(AuthWellKnown.Service)({ - configs: () => Effect.succeed([]), -}) const configLayer = Config.layer.pipe( Layer.provide(EffectFlock.defaultLayer), Layer.provide(AppFileSystem.defaultLayer), - Layer.provide(emptyAuthWellKnown), + Layer.provide(AuthWellKnownTest.empty), Layer.provide(Substitution.defaultLayer), Layer.provide(Env.defaultLayer), Layer.provide(emptyAuth),