| @@ -9,6 +9,7 @@ import * as Layer from "effect/Layer"; · 8 unmodified lines |
| 9 | import * as Stream from "effect/Stream"; | 9 | import * as Stream from "effect/Stream"; |
| 10 | import { AsyncResult, Atom, AtomRegistry } from "effect/unstable/reactivity"; | 10 | import { AsyncResult, Atom, AtomRegistry } from "effect/unstable/reactivity"; |
| 11 | | 11 | |
| | 12 | import { EnvironmentRegistry } from "../connection/registry.ts"; |
| 12 | import { | 13 | import { |
| 13 | environmentRpcKey, | 14 | environmentRpcKey, |
| 14 | createAtomCommandScheduler, | 15 | createAtomCommandScheduler, |
| @@ -22,6 +23,19 @@ import { · 7 unmodified lines |
| 22 | settlePromise, | 23 | settlePromise, |
| 23 | squashAtomCommandFailure, | 24 | squashAtomCommandFailure, |
| 24 | } from "./runtime.ts"; | 25 | } from "./runtime.ts"; |
| | 26 | import { createVcsEnvironmentAtoms } from "./vcs.ts"; |
| | 27 | |
| | 28 | describe("VCS status subscription lifecycle", () => { |
| | 29 | it("removes the status subscription immediately after its last consumer unmounts", () => { |
| | 30 | const runtime = Atom.runtime(Layer.effect(EnvironmentRegistry, Effect.never)); |
| | 31 | const statusAtom = createVcsEnvironmentAtoms(runtime).status({ |
| | 32 | environmentId: EnvironmentId.make("env-1"), |
| | 33 | input: { cwd: "/repo" }, |
| | 34 | }); |
| | 35 | |
| | 36 | expect(statusAtom.idleTTL).toBe(0); |
| | 37 | }); |
| | 38 | }); |
| 25 | | 39 | |
| 26 | describe("settleAsyncResult", () => { | 40 | describe("settleAsyncResult", () => { |
| 27 | it("preserves successful values and typed failures", async () => { | 41 | it("preserves successful values and typed failures", async () => { |