Currently I'm working on unit tests creation for my project, the part of code I'm writing tests looks like:
{errors.map(error => (
<li
data-testid={`${error.key}-error-item`}
key={error.key}
className={error.className}
>
<Container>{error.message}</Container>
</li>
))}
I use a dynamic `data-tested key to get this element within tests. My test looks like this:
...
expect(screen.queryAllByTestId(`${error.key}-error-item`).length).toEqual(1)
...
But this test fails, please tell me how can I get items by `dynamic data-tested property?