Skip to content

Commit

Permalink
Change "count" to "length" in test as well
Browse files Browse the repository at this point in the history
  • Loading branch information
pirelenito committed Jul 25, 2024
1 parent f99036b commit db91fda
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/@react-facet/core/src/components/Map.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,21 +146,20 @@ it('updates only items that have changed', () => {
expect(mock).toHaveBeenCalledWith({ a: '6' })
})

it('count returns length of provided array', () => {
it('provides the length of the array', () => {
const data = createFacet({
initialValue: [{ a: '1' }, { a: '2' }, { a: '3' }],
})

const ExampleContent = ({ index, count }: { index: number; count: number }) => {
return <>{count === index + 1 && <div data-testid={'count'}>{count}</div>}</>
const ExampleContent = ({ index, length }: { index: number; length: number }) => {
return <>{length === index + 1 && <div data-testid={'length'}>{length}</div>}</>
}

const Example = () => {
return <Map array={data}>{(_, index, count) => <ExampleContent index={index} count={count} />}</Map>
return <Map array={data}>{(_, index, length) => <ExampleContent index={index} length={length} />}</Map>
}

const { getByTestId } = render(<Example />)

const counter = getByTestId('count')
expect(counter).toHaveTextContent('3')
expect(getByTestId('length')).toHaveTextContent('3')
})

0 comments on commit db91fda

Please sign in to comment.