Our post should probably have a creation date associated with it (typically you’ll add this on the server, but for the purposes of our example, we’ll do it on the client). Dates are notoriously challenging to test. There are existing libraries that help, but often you can get close enough to the desired effect for your assertions. Let’s go ahead and test that a correct creation date has been set for our posts.


Test Drive Assertions with Dates in React