Profile cover photo
Profile photo
bguiz.com
7 followers
7 followers
About
Posts

Post has attachment
Property-based #testing in #Javascript + generating example-based tests from failures via Jest snapshots
Add a comment...

Post has attachment
react-router v4 removed onUpdate()
Here's a proof-of-concept HOC + example usage w/ Google Analytics
http://buff.ly/2v1lPaq #react #js
Add a comment...

Post has attachment
Excited to be speaking at CampJs VIII about testing #nodejs apps using Jest

"The Caffeinated Jester"

http://buff.ly/2uEsALg
Photo
Add a comment...

Post has attachment
Video of "The Caffeinated Jester", for those who missed the talk a few weeks ago.

This one includes a live demo (at the end) that focuses on using `--watch` mode with snapshot testing plus code coverage at the same time.
It shows how to accomplish test-driven development (with some variation), as well as parametric tests that can go from being DAMP to DRY.
Conversely, it also shows the pitfalls of snapshot tests, in how easy it is to mistakenly "over fit" your expectation to your results.

#js #test #mocha #jest #nodejs #tdd #snapshots
Add a comment...

Post has attachment
Part 2 of how to use PostgreSql as a document DB:
JSON merge that avoids lost update scenarios in transactions through server-side only operations.

The support for both relational and document database paradigms in PostgreSql is powerful. However, combining them such that we get the benefits of both can be tricky. This post examines a way to do just that.


#postgresql #database #sql
Add a comment...

Post has attachment
#enlightenment in #async #javascript: callbacks or promises or generator fns or async fns?
Photo
Add a comment...

Post has attachment
When the business logic of the application has no clear demarcation of separate operations for create and update operations, an upsert is what you need. PostgreSql landed support for upsert in 9.5, via the "on conflict do update" clause in insert statements. This post is a short explainer on upserts in general, plus how to do an upsert in a node application using knex to interface with the database.

#postgresql #sql #nodejs
Add a comment...

Post has attachment
The value proposition of Jest as a testing framework is very strong. This post will highlight several contrasting concepts learnt as part of the process of migrating from mocha+chai+sinon to Jest. It also explores a “general” use case for Jest - not ReactJs, not in-browser Javascript - for a NodeJs API.

Jest requires one to change the way we think about mocks, and fake timers. In addition, the introduction of snapshots, makes us re-consider the DRY-DAMP paradigm.
Add a comment...

Post has attachment
Testing enlightenment
#woke #dry #damp #snapshots
Photo
Add a comment...

Post has attachment
How to mock chained APIs in #jest:
#testing #javascript #blog

A chained API is one which returns the original object, rather than the result of the operation, from each function call. An object which exposes a chained API is great for both its implementor, and its consumer… but not so great for someone who wishes to mock it for testing purposes.

In this post, we will explore how to use a chained API (from jest) to test another chained API (from express), by splitting mock definitions from mock implementations.
Add a comment...
Wait while more posts are being loaded