Skip to content

Commit

Permalink
Ensure that and and or will updated with scope
Browse files Browse the repository at this point in the history
  • Loading branch information
zerobias committed Nov 27, 2023
1 parent 033c966 commit 099d034
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/and/and.fork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,19 @@ test('When at least one store has falsy value result must be false', async () =>
await allSettled(iterate, { scope });
await allSettled(iterate, { scope });

expect(scope.getState($result)).toBe(false);
expect(fn).toHaveBeenCalledTimes(1);

await allSettled(iterate, { scope });

expect(fn).toHaveBeenCalledTimes(2);
expect(argumentHistory(fn)).toMatchInlineSnapshot(`
[
false,
true,
]
`);
expect(scope.getState($result)).toBe(false);
expect(scope.getState($result)).toBe(true);
});

test('Returns boolean value for single store', async () => {
Expand Down
8 changes: 7 additions & 1 deletion src/or/or.fork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@ it('should be true when at least one store has truthy value', async () => {
await allSettled(iterate, { scope });

expect(fn).toHaveBeenCalledTimes(1);
expect(scope.getState($result)).toBe(true);

await allSettled(iterate, { scope });

expect(fn).toHaveBeenCalledTimes(2);
expect(argumentHistory(fn)).toMatchInlineSnapshot(`
[
true,
false,
]
`);
expect(scope.getState($result)).toBe(true);
expect(scope.getState($result)).toBe(false);
});

test('Returns boolean value for single store', async () => {
Expand Down

0 comments on commit 099d034

Please sign in to comment.