mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
33 lines
817 B
JavaScript
33 lines
817 B
JavaScript
|
expect.extend({
|
||
|
toHaveSameBlockIdAs(received, otherChild) {
|
||
|
const { id: thisId } = received;
|
||
|
const { id: otherId } = otherChild;
|
||
|
|
||
|
if (thisId === undefined || thisId === null) {
|
||
|
return {
|
||
|
message: 'expected block id not to be null or undefined',
|
||
|
pass: false,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
if (otherId === undefined || otherId === null) {
|
||
|
return {
|
||
|
message: 'expected other block id not to be null or undefined',
|
||
|
pass: false,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
return thisId === otherId
|
||
|
? {
|
||
|
message: () =>
|
||
|
`expected block id '${thisId}' not to match other id '${otherId}'`,
|
||
|
pass: true,
|
||
|
}
|
||
|
: {
|
||
|
message: () =>
|
||
|
`expected block id '${thisId}' to match other id '${otherId}'`,
|
||
|
pass: false,
|
||
|
};
|
||
|
},
|
||
|
});
|