Replace Instance.disposeAll/load with fixture helper (#25418)

This commit is contained in:
Kit Langton
2026-05-02 10:56:15 -04:00
committed by GitHub
parent 5242a1c6b4
commit 4c4860fb24
59 changed files with 139 additions and 130 deletions
+4 -4
View File
@@ -3,7 +3,7 @@ import { Schema } from "effect"
import { Bus } from "../../src/bus"
import { BusEvent } from "../../src/bus/bus-event"
import { Instance } from "../../src/project/instance"
import { tmpdir } from "../fixture/fixture"
import { disposeAllInstances, tmpdir } from "../fixture/fixture"
const TestEvent = {
Ping: BusEvent.define("test.ping", Schema.Struct({ value: Schema.Number })),
@@ -15,7 +15,7 @@ function withInstance(directory: string, fn: () => Promise<void>) {
}
describe("Bus", () => {
afterEach(() => Instance.disposeAll())
afterEach(() => disposeAllInstances())
describe("publish + subscribe", () => {
test("subscriber is live immediately after subscribe returns", async () => {
@@ -208,8 +208,8 @@ describe("Bus", () => {
await Bun.sleep(10)
})
// Instance.disposeAll triggers the finalizer which publishes InstanceDisposed
await Instance.disposeAll()
// disposeAllInstances triggers the finalizer which publishes InstanceDisposed
await disposeAllInstances()
await Bun.sleep(50)
expect(received).toContain("test.ping")