- Sep 2021
-
testing-library.com testing-library.com
-
though we recommend Jest as our preference, the library works with any framework
-
- Sep 2020
- Apr 2020
-
medium.com medium.com
-
We really only need to test that the button gets rendered at all (we don’t care about what the label says — it may say different things in different languages, depending on user locale settings). We do want to make sure that the correct number of clicks gets displayed
An example of how to think about tests. Also asserting against text that's variable isn't very useful.
-
- Dec 2019
-
master.neutrinojs.org master.neutrinojs.org
-
Various test runners support using compiled webpack code to drive tests, but may be difficult to integrate with webpack, and Neutrino helps alleviate this
-
-
- Nov 2019
-
stackoverflow.com stackoverflow.com
-
Since the checkbox is rendering an input I would work with it rather than focusing on the image. You could do something like this: const checkbox = getByTestId('checkbox-1234').querySelector('input[type="checkbox"]') expect(checkbox).toHaveProperty('checked', true)
-
the way Material UI works is it renders a different SVG when the checkbox is clicked, and not changing the attributes or anything on the actual input element. So how do I actually test that the element is checked in line with the react-testing-library philosophy?
These tags belong to entire page. This quote is just supporting evidence for the tags.
-
-
github.com github.com
-
Tests implementation details a bit (child component props received), but pretty good other than that.
https://www.robinwieruch.de/react-testing-tutorial, for example, says that is reasonable to do:
an integration test could verify that all necessary props are passed through from the tested component to a specific child component.
-
-
jestjs.io jestjs.io
-
github.com github.com
-
I don't recommend unit testing stateful components, or components with side-effects. Write functional tests for those, instead, because you'll need tests which describe the complete end-to-end flow, from user input, to back-end-services, and back to the UI. Those tests frequently duplicate any testing effort you would spend unit-testing stateful UI behaviors. You'd need to do a lot of mocking to properly unit test those kinds of components anyway, and that mocking may cover up problems with too much coupling in your component.
-
-
github.com github.com
-
Although this page only mentions using with Jest, you can use it without Jest: https://testing-library.com/docs/react-testing-library/setup#using-without-jest
-
-
testing-library.com testing-library.com
-
This library is a replacement for Enzyme.
-
-
www.valentinog.com www.valentinog.com
-
gist.github.com gist.github.com
-
github.com github.com
-
github.com github.com
-
jestjs.io jestjs.io
-
-
medium.com medium.com
-
The amount of dev time it saves is uncanny. Like, what used to take 3 hours to write now takes like 30 minutes. No joke.
-
-
-
www.npmjs.com www.npmjs.comts-mocha1
-
airbnb.io airbnb.io
- Sep 2018
-
-
Javascript
This is a public note. Javascript FTW
-
- Apr 2016
-
facebook.github.io facebook.github.io
-
Brief but useful contrast of Jest vs. Angular approaches to dependency injection.
The argument is that most code uses one implementation in production and one mock in testing and that using
require()
as the seam for inserting test doubles makes code easier to write than Angular's approach of implementing its own module system and DI container.
-
- Feb 2016
-
inversify.io inversify.io
-
I'm not sure I like the requirement to use classes but some interesting notes on dependency injection for JS
-