:heart: I really like this. This will also be useful for #494.

Can you add some unit tests for it?