Issue
I am coding on a Next.js project for a while. My project has i18n support and I want to write unit tests. But I couldn't figure out how to write effective tests. Am I supposed to write unit tests for each language (English, Dutch, etc) or is there any better approach?
Solution
I guess, as I read from Kent C Dodds' article and Testing Library FAQ, in the following links you will find answers you are seeking. But before visiting the pages, here is a brief quotation from the doc:
Our first bit of advice is to try to get the default text used in your tests.
- Testing Library FAQ: https://testing-library.com/docs/dom-testing-library/faq
- Kent's article's section: https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#not-querying-by-text
I hope, these links will help you write your tests.
Answered By - Kalender
Answer Checked By - - Marilyn (ReactFix Volunteer)