You need to check a date using Chai. You also need to account for the test execution time.
Chai lets you assert that some code throws an error. The key is to pass the test subject to
expect, not the test result.
Don't use "deep equals" when comparing arrays with Chai; it depends on element order. Examine the array members instead.
A quick and easy way to ensure your tests don't have any unwanted side-effects is to randomise the order in which they run. PHPUnit makes this easy.
Sign up for my newsletter
A monthly round-up of blog posts, projects, and internet oddments.