Date.now Mocking in Jest - Code with Hugo - May 28th 2019
Hot off the press
Mocking/stubbing the current Date in Jest tests: How to mock accessing the current date in Jest.
I’ve been adding a few more Netlify lambda’s to codewithhugo.com, coming soon are be in-depth posts about how to leverage Netlify’s Lambdas, see more at github.com/HugoDF/pocket-newsletter-lambda and github.com/HugoDF/netlify-lambda-tailwind-static-starter.
Example chart generated by my analytics report @Netlify lambda Built with , triggered a few times a day using @IFTTT Fetches data from @SimpleAnalytic
Open Source Chart Image API | QuickChart
Create a chart image with one URL and embed anywhere. Open source, no watermarks.
For more Tailwind CSS goodness in an Express setting, see github.com/HugoDF/express-nunjucks-tailwind.
If you missed it
Avoiding recursion pitfalls: MongoDB nested query clause addition and removal: A case-study on where recursion can be useful for enterprise Node.js applications and how to avoid its common pitfalls like RangeError: Maximum call stack size exceeded.
Docker Compose Local HTTPS with nginx or Caddy and mkcert: A solution to serve your Dockerized application on Docker Compose with TLS/SSL locally by leveraging a HTTPS reverse-proxy and mkcert.
Jest assert over single or specific argument/parameters with .toHaveBeenCalledWith and expect.anything(): With Jest it’s possible to assert of single or specific arguments/parameters of a mock function call with .toHaveBeenCalled/.toBeCalled and expect.anything().
From the web
TechnicalDebt by Martin Fowler : Software systems are prone to the build up of cruft - deficiencies in internal quality that make it harder than it would ideally be to modify and extend the system further.
CannotMeasureProductivity by Martin Fowler: We see so much emotional discussion about software process, design practices and the like. Many of these arguments are impossible to resolve because the software industry lacks the ability to measure some of the basic elements of the effectiveness of software development.
How SQLite Is Tested: The reliability and robustness of SQLite is achieved in part by thorough and careful testing. As of version 3.23.0 (2018-04-02), the SQLite library consists of approximately 128.9 KSLOC of C code.
How FriendFeed uses MySQL to store schema-less data: We use MySQL for storing all of the data in FriendFeed. Our database has grown a lot as our user base has grown. We now store over 250 million entries and a bunch of other data, from comments and “likes” to friend lists.