We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
to fix the problem with the testing feedback you need to modify 4 parts of the code so the test can pass.
The issue is that the initial code has data-testid attributes that are fixed to 0. This prevents the testing mechanism from working properly because the tests rely on unique identifiers for each element. To resolve this, you need to change the fixed 0 to a dynamic value (like using index), ensuring each element has a unique data-testid.
1 - first change the (data-testid) in the upvote and downvote buttons:
Code Review Feedback
You are viewing a single comment's thread. Return to all comments →
Hello everyone,
to fix the problem with the testing feedback you need to modify 4 parts of the code so the test can pass.
The issue is that the initial code has data-testid attributes that are fixed to 0. This prevents the testing mechanism from working properly because the tests rely on unique identifiers for each element. To resolve this, you need to change the fixed 0 to a dynamic value (like using index), ensuring each element has a unique data-testid.
1 - first change the (data-testid) in the upvote and downvote buttons:
data-testid={
upvote-btn-${index}}
data-testid={
downvote-btn-${index}}
2- Finally, change the (data-testid) in the p tags that shows the upvote and downvote count inside of them like this:
data-testid={
upvote-count-${index}}
data-testid={
downvote-count-${index}}
you need to be mapping through an array of the feedback aspects for this to work.
this will hopefully solve the problem with the testing, if anything else occurs, check your code again.