Skip to content

Commit

Permalink
Revert unwanted changes to count returns length of provided array
Browse files Browse the repository at this point in the history
  • Loading branch information
hebbeh committed Jul 23, 2024
1 parent 3023084 commit 69c2972
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/@react-facet/core/src/components/Map.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ it('updates only items that have changed', () => {

const mock = jest.fn()

const ExampleContent = ({ item, count }: { item: Facet<Input>; count: number }) => {
const ExampleContent = ({ item }: { item: Facet<Input> }) => {
useFacetEffect(mock, [], [item])
return <div data-testId={'count'}>{count}</div>
return null
}

const inputEqualityCheck = () => {
Expand All @@ -125,11 +125,15 @@ it('updates only items that have changed', () => {
const Example = () => {
return (
<Map array={data} equalityCheck={inputEqualityCheck}>
{(item, count) => <ExampleContent item={item} count={count} />}
{(item) => <ExampleContent item={item} />}
</Map>
)
}

const scenario = <Example />

render(scenario)

expect(mock).toHaveBeenCalledTimes(5)

mock.mockClear()
Expand Down

0 comments on commit 69c2972

Please sign in to comment.