diff --git a/src/or/or.fork.test.ts b/src/or/or.fork.test.ts index fb8bf456..20de9841 100644 --- a/src/or/or.fork.test.ts +++ b/src/or/or.fork.test.ts @@ -26,11 +26,10 @@ it('should be true when at least one store has truthy value', async () => { await allSettled(iterate, { scope }); await allSettled(iterate, { scope }); - expect(fn).toHaveBeenCalledTimes(2); // twice because of scope and initial + expect(fn).toHaveBeenCalledTimes(1); expect(argumentHistory(fn)).toMatchInlineSnapshot(` [ true, - true, ] `); expect(scope.getState($result)).toBe(true); @@ -45,3 +44,20 @@ test('Returns boolean value for single store', async () => { expect(scope.getState($andIncorrect)).toBe(true); }); + +test('should be false when all stores have falsy value', async () => { + const fix = createEvent(); + const $a = createStore(true).on(fix, () => false); + const $b = createStore(false); + const $c = createStore(false); + + const $or = or($a, $b, $c); + + const scope = fork(); + + expect(scope.getState($or)).toBe(true); + + await allSettled(fix, { scope }); + + expect(scope.getState($or)).toBe(false); +});