diff --git a/packages/reffuse/src/tests.ts b/packages/reffuse/src/tests.ts new file mode 100644 index 0000000..cbb2db7 --- /dev/null +++ b/packages/reffuse/src/tests.ts @@ -0,0 +1,17 @@ +import { Effect, Exit, PubSub, Scope, Stream } from "effect" + + +await Effect.gen(function*() { + const scope = yield* Scope.make() + + const pubsub = yield* PubSub.unbounded() + console.log(yield* PubSub.isShutdown(pubsub)) + const stream = yield* Stream.fromPubSub(pubsub, { scoped: true, shutdown: true }).pipe( + Effect.provideService(Scope.Scope, scope) + ) + + yield* Scope.close(scope, Exit.void) + console.log(yield* PubSub.isShutdown(pubsub)) +}).pipe( + Effect.runPromise, +)