bahmutov / snap-shot

Jest-like snapshot feature for the rest of us, works magically by finding the right caller function
169 stars 3 forks source link

Allow passing comparator function #65

Open bahmutov opened 7 years ago

bahmutov commented 7 years ago

Like https://github.com/staltz/html-looks-like to compare expected (snapshot) and actual value. Maybe check if the function is binary to tell apart from data-driven testing

const isPrime = n => ...
snapshot(isPrime, 1, 2, 3)
// data-drive, because isPrime is unary?
const htmlLooksLike = require('html-looks-like')
snapshot(htmlLooksLike, someText)
// comparator function because binary function and single value