Open hspotlight opened 3 years ago
I can take a look and help with this. By component test you mean testing the components inside src/components, right?
Hi @huycans . Thank for help. yes I would like to have test src/components. I see that with create-react-app provide with testing-library too but I don't know how to do. can you make an example for one component. for example, should render text. thanks.
Sure, give me a couple days to setup and i can write a basic example test for you.
PR's up. I setup a test folder, you can write other tests there. I also wrote a basic test for your AppHeaderBar, which included a snapshot test and a 'render text correctly' test. From it, you can write other similar snapshot tests for other simple components if you want.
By the way, I'm trying to test your whole app in App.test.tsx, but Jest cannot render your app due to a "Map container not found." error. I think it's related to this: https://stackoverflow.com/questions/65604960/react-leaflet-map-container-not-found. Can you see if you can fix this and run the commented out tests in App.test.tsx?
It didn't setup yet. Currently, this project only have unit test using jest. It would be nice if we have a component test. React Testing Library is nice. I like it but don't know how to do? Please help.