diff --git a/packages/core/test/catalog.test.ts b/packages/core/test/catalog.test.ts index e10c00bcd6f..ab670be22c9 100644 --- a/packages/core/test/catalog.test.ts +++ b/packages/core/test/catalog.test.ts @@ -84,7 +84,8 @@ describe("Catalog", () => { return Effect.gen(function* () { const catalog = yield* Catalog.Service - yield* (yield* Integration.Service).transform((editor) => editor.update(integrationID, () => {})) + const integrations = yield* Integration.Service + yield* integrations.transform((editor) => editor.update(integrationID, () => {})) yield* catalog.transform((editor) => editor.provider.update(providerID, (provider) => { provider.integrationID = integrationID @@ -92,7 +93,8 @@ describe("Catalog", () => { ) expect(yield* catalog.provider.available()).toEqual([]) - yield* (yield* Credential.Service).create({ + const credentials = yield* Credential.Service + yield* credentials.create({ integrationID, value: Credential.Key.make({ type: "key", key: "secret" }), }) @@ -112,7 +114,8 @@ describe("Catalog", () => { return Effect.gen(function* () { const catalog = yield* Catalog.Service - yield* (yield* Integration.Service).transform((editor) => editor.update(integrationID, () => {})) + const integrations = yield* Integration.Service + yield* integrations.transform((editor) => editor.update(integrationID, () => {})) yield* catalog.transform((editor) => editor.provider.update(providerID, (provider) => { provider.integrationID = integrationID diff --git a/packages/core/test/effect/layer-node/layer-node.test.ts b/packages/core/test/effect/layer-node/layer-node.test.ts index c344594c453..5c36f20255b 100644 --- a/packages/core/test/effect/layer-node/layer-node.test.ts +++ b/packages/core/test/effect/layer-node/layer-node.test.ts @@ -201,7 +201,8 @@ describe("layer node", () => { Layer.provide(LayerNode.compile(result.hoisted)), ) as unknown as Layer.Layer const program = Effect.gen(function* () { - return yield* (yield* App).run + const app = yield* App + return yield* app.run }).pipe(Effect.provide(layer)) expect(await Effect.runPromise(program)).toEqual(["Alice"]) diff --git a/packages/core/test/location-filesystem.test.ts b/packages/core/test/location-filesystem.test.ts index 77601886a8f..d3b1a76bf52 100644 --- a/packages/core/test/location-filesystem.test.ts +++ b/packages/core/test/location-filesystem.test.ts @@ -51,7 +51,8 @@ describe("FileSystem", () => { Effect.gen(function* () { yield* Effect.promise(() => fs.mkdir(path.join(directory, "src"))) yield* Effect.promise(() => fs.writeFile(path.join(directory, "README.md"), "# Test")) - const entries = yield* (yield* FileSystem.Service).list() + const filesystem = yield* FileSystem.Service + const entries = yield* filesystem.list() expect(entries.map((entry) => ({ path: entry.path, type: entry.type }))).toEqual([ { path: RelativePath.make("src" + path.sep), type: "directory" }, { path: RelativePath.make("README.md"), type: "file" }, @@ -103,9 +104,8 @@ describe("FileSystem", () => { it.live("rejects lexical escapes", () => withTmp((directory) => Effect.gen(function* () { - const result = yield* (yield* FileSystem.Service) - .read({ path: RelativePath.make("../outside.txt") }) - .pipe(Effect.exit) + const filesystem = yield* FileSystem.Service + const result = yield* filesystem.read({ path: RelativePath.make("../outside.txt") }).pipe(Effect.exit) expect(Exit.isFailure(result)).toBe(true) }).pipe(provide(directory)), ), diff --git a/packages/core/test/location-layer.test.ts b/packages/core/test/location-layer.test.ts index 9ce09cb2397..b38ab70b697 100644 --- a/packages/core/test/location-layer.test.ts +++ b/packages/core/test/location-layer.test.ts @@ -518,7 +518,8 @@ describe("LocationServiceMap", () => { ) const plugins = yield* Effect.gen(function* () { const plugins = yield* Plugin.Service - yield* (yield* PluginSupervisor.Service).flush + const supervisor = yield* PluginSupervisor.Service + yield* supervisor.flush return yield* plugins.list() }).pipe( Effect.scoped, @@ -942,7 +943,8 @@ describe("LocationServiceMap", () => { }) yield* plugins.activate([{ ...reviewer, version: "1" }]) - expect(yield* (yield* Agent.Service).get(Agent.ID.make("reviewer"))).toMatchObject({ + const agents = yield* Agent.Service + expect(yield* agents.get(Agent.ID.make("reviewer"))).toMatchObject({ description: "Reviews code", mode: "subagent", }) diff --git a/packages/core/test/location-mutation.test.ts b/packages/core/test/location-mutation.test.ts index 461190f750b..f3753d44432 100644 --- a/packages/core/test/location-mutation.test.ts +++ b/packages/core/test/location-mutation.test.ts @@ -43,7 +43,8 @@ describe("LocationMutation", () => { Effect.gen(function* () { const targetPath = path.join(directory, "hello.txt") yield* Effect.promise(() => fs.writeFile(targetPath, "hello")) - const target = yield* (yield* LocationMutation.Service).resolve({ path: "hello.txt" }) + const mutation = yield* LocationMutation.Service + const target = yield* mutation.resolve({ path: "hello.txt" }) expect(target).toMatchObject({ absolute: targetPath, @@ -58,7 +59,8 @@ describe("LocationMutation", () => { withTmp((directory) => Effect.gen(function* () { yield* Effect.promise(() => fs.mkdir(path.join(directory, "src"))) - const target = yield* (yield* LocationMutation.Service).resolve({ path: path.join("src", "new.txt") }) + const mutation = yield* LocationMutation.Service + const target = yield* mutation.resolve({ path: path.join("src", "new.txt") }) expect(target).toMatchObject({ absolute: path.join(directory, "src", "new.txt"), resource: "src/new.txt", @@ -70,7 +72,8 @@ describe("LocationMutation", () => { it.live("requires external-directory authorization for a relative lexical escape", () => withTmp((directory) => Effect.gen(function* () { - const target = yield* (yield* LocationMutation.Service).resolve({ path: "../outside.txt" }) + const mutation = yield* LocationMutation.Service + const target = yield* mutation.resolve({ path: "../outside.txt" }) const root = path.dirname(directory) expect(target).toMatchObject({ absolute: path.join(root, "outside.txt"), @@ -117,7 +120,8 @@ describe("LocationMutation", () => { await fs.mkdir(outside) await fs.symlink(outside, path.join(directory, "escape")) }) - const target = yield* (yield* LocationMutation.Service).resolve({ path: path.join("escape", "new.txt") }) + const mutation = yield* LocationMutation.Service + const target = yield* mutation.resolve({ path: path.join("escape", "new.txt") }) expect(target).toMatchObject({ absolute: path.join(directory, "escape", "new.txt"), resource: "escape/new.txt", @@ -137,7 +141,8 @@ describe("LocationMutation", () => { await fs.symlink(path.join(directory, "actual"), path.join(directory, "linked")) }) - expect(yield* (yield* LocationMutation.Service).resolve({ path: "linked/new.txt" })).toMatchObject({ + const mutation = yield* LocationMutation.Service + expect(yield* mutation.resolve({ path: "linked/new.txt" })).toMatchObject({ absolute: path.join(directory, "linked", "new.txt"), resource: "linked/new.txt", }) @@ -149,7 +154,8 @@ describe("LocationMutation", () => { withTmp((directory) => Effect.gen(function* () { const targetPath = path.join(directory, "new.txt") - const target = yield* (yield* LocationMutation.Service).resolve({ path: targetPath }) + const mutation = yield* LocationMutation.Service + const target = yield* mutation.resolve({ path: targetPath }) expect(target).toMatchObject({ absolute: targetPath, resource: "new.txt", @@ -164,7 +170,8 @@ describe("LocationMutation", () => { withTmp((outside) => Effect.gen(function* () { const targetPath = path.join(outside, "new.txt") - const target = yield* (yield* LocationMutation.Service).resolve({ path: targetPath }) + const mutation = yield* LocationMutation.Service + const target = yield* mutation.resolve({ path: targetPath }) const root = outside expect(target).toMatchObject({ absolute: path.join(root, "new.txt"), @@ -185,7 +192,8 @@ describe("LocationMutation", () => { Effect.gen(function* () { const targetPath = path.join(outside, "existing.txt") yield* Effect.promise(() => fs.writeFile(targetPath, "existing")) - const target = yield* (yield* LocationMutation.Service).resolve({ path: targetPath }) + const mutation = yield* LocationMutation.Service + const target = yield* mutation.resolve({ path: targetPath }) expect(target).toMatchObject({ absolute: targetPath }) expect(target.externalDirectory?.directory).toBe(outside) }).pipe(provide(directory)), @@ -197,7 +205,8 @@ describe("LocationMutation", () => { withTmp((directory) => withTmp((outside) => Effect.gen(function* () { - const target = yield* (yield* LocationMutation.Service).resolve({ path: outside, kind: "file" }) + const mutation = yield* LocationMutation.Service + const target = yield* mutation.resolve({ path: outside, kind: "file" }) expect(target.externalDirectory).toMatchObject({ directory: path.dirname(outside), resource: path.join(path.dirname(outside), "*").replaceAll("\\", "/"), @@ -212,7 +221,8 @@ describe("LocationMutation", () => { withTmp((outside) => Effect.gen(function* () { const targetPath = path.join(outside, "new", "nested", "file.txt") - const target = yield* (yield* LocationMutation.Service).resolve({ path: targetPath }) + const mutation = yield* LocationMutation.Service + const target = yield* mutation.resolve({ path: targetPath }) const parent = path.dirname(targetPath) expect(target.externalDirectory).toMatchObject({ directory: parent, @@ -254,7 +264,8 @@ describe("LocationMutation", () => { it.live("resolves a tilde path as an external home target", () => withTmp((directory) => Effect.gen(function* () { - const target = yield* (yield* LocationMutation.Service).resolve({ path: "~/notes.md" }) + const mutation = yield* LocationMutation.Service + const target = yield* mutation.resolve({ path: "~/notes.md" }) const absolute = path.resolve(Global.Path.home, "notes.md") expect(target).toMatchObject({ absolute, @@ -270,7 +281,8 @@ describe("LocationMutation", () => { it.live("treats a tilde path as in-location when the location is home", () => Effect.gen(function* () { - const target = yield* (yield* LocationMutation.Service).resolve({ path: "~/notes.md" }) + const mutation = yield* LocationMutation.Service + const target = yield* mutation.resolve({ path: "~/notes.md" }) expect(target).toMatchObject({ absolute: path.resolve(Global.Path.home, "notes.md"), resource: "notes.md", diff --git a/packages/core/test/repository-cache.test.ts b/packages/core/test/repository-cache.test.ts index 435584a719d..ed033f9ba9e 100644 --- a/packages/core/test/repository-cache.test.ts +++ b/packages/core/test/repository-cache.test.ts @@ -25,7 +25,8 @@ describe("RepositoryCache", () => { await fs.writeFile(path.join(localPath, "stale.txt"), "stale") }) - const result = yield* (yield* RepositoryCache.Service).ensure({ reference: fixture.reference }) + const cache = yield* RepositoryCache.Service + const result = yield* cache.ensure({ reference: fixture.reference }) expect(result.status).toBe("cloned") expect(yield* exists(path.join(localPath, "stale.txt"))).toBe(false) @@ -94,7 +95,8 @@ describe("RepositoryCache", () => { Effect.gen(function* () { yield* Effect.promise(() => git(fixture.root, "clone", fixture.remote, path.join(fixture.root, "repos"))) - const result = yield* (yield* RepositoryCache.Service).ensure({ reference: fixture.reference }) + const cache = yield* RepositoryCache.Service + const result = yield* cache.ensure({ reference: fixture.reference }) expect(result.status).toBe("cloned") expect(yield* read(path.join(result.localPath, "README.md"))).toBe("one\n")