From 9f037e7718cdddf8919e90dea5da70abcfce7add Mon Sep 17 00:00:00 2001 From: hugos68 Date: Fri, 3 May 2024 11:49:15 +0200 Subject: [PATCH] Improved reactive prop test case --- src/lib/hooks/useInteractions/index.test.svelte.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/hooks/useInteractions/index.test.svelte.ts b/src/lib/hooks/useInteractions/index.test.svelte.ts index a5ace44c..f18224c6 100644 --- a/src/lib/hooks/useInteractions/index.test.svelte.ts +++ b/src/lib/hooks/useInteractions/index.test.svelte.ts @@ -38,12 +38,13 @@ describe('useInteractions', () => { const interactions = useInteractions([interaction]); - expect(interactions.getReferenceProps()).toHaveProperty('data-count'); - expect(interactions.getReferenceProps()['data-count']).toBe(0); + const count = $derived(interactions.getReferenceProps()['data-count']); + + expect(count).toBe(0); reference['data-count'] = 1; - expect(interactions.getReferenceProps()['data-count']).toBe(1); + expect(count).toBe(1); }); it('overrides duplicate non-eventlistener props with the latest interaction', () => { const interactionOne: ElementProps = {