From 0d800eef56ed348ac67097166c5c5ad5e38c0213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Fri, 17 Jul 2026 00:11:38 +0200 Subject: [PATCH] Fix tests --- packages/effect-lens-next/src/Lens.test.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/effect-lens-next/src/Lens.test.ts b/packages/effect-lens-next/src/Lens.test.ts index 8bc85c8..db5602a 100644 --- a/packages/effect-lens-next/src/Lens.test.ts +++ b/packages/effect-lens-next/src/Lens.test.ts @@ -187,7 +187,7 @@ describe("Lens", () => { expect(result[1]).toBe(25) }) - test("Ref and SynchronizedRef adapters read and update their sources", async () => { + test("Ref, SynchronizedRef, and SubscriptionRef adapters read and update their sources", async () => { const result = await Effect.runPromise(Effect.gen(function*() { const ref = yield* Ref.make(1) const refLens = yield* Lens.fromRef(ref) @@ -195,12 +195,20 @@ describe("Lens", () => { const synchronizedRef = yield* SynchronizedRef.make(10) const synchronizedLens = Lens.fromSynchronizedRef(synchronizedRef) - yield* Lens.updateEffect(synchronizedLens, n => Effect.succeed(n + 5)) + yield* Lens.update(synchronizedLens, n => n + 5) - return [yield* Ref.get(ref), yield* SynchronizedRef.get(synchronizedRef)] as const + const subscriptionRef = yield* SubscriptionRef.make(100) + const subscriptionLens = Lens.fromSubscriptionRef(subscriptionRef) + yield* Lens.update(subscriptionLens, n => n + 2) + + return [ + yield* Ref.get(ref), + yield* SynchronizedRef.get(synchronizedRef), + yield* SubscriptionRef.get(subscriptionRef), + ] as const })) - expect(result).toEqual([2, 15]) + expect(result).toEqual([2, 15, 102]) }) test("modifyEffect updates are atomic under concurrency", async () => {