Writing Unit Tests with Jest
What Jest feature enables custom assertion creation?
expect.extend({
toBeWithinRange(received, floor, ceiling) {
const pass = received >= floor && received <= ceiling;
return {
pass,
message: () => `expected ${received} to be within range ${floor} - ${ceiling}`
};
}
});