Define A Custom Jest Matcher
expect.extend({
toHaveMatchingId(recieved, expected) {
const pass = recieved.id === expected.id;
if (pass) {
return {
pass: true,
message: () =>
`expected id:${expected.id} to not match actual id:${recieved.id}`
};
} else {
return {
pass: false,
message: () =>
`expected id:${expected.id} to match actual id:${recieved.id}`
};
}
}
});PreviousDefault And Named Exports From The Same ModuleNextDestructure With Access To Nested Value And Parent Value
Last updated