utils.js 817 B

1234567891011121314151617181920212223242526272829303132
  1. expect.extend({
  2. toHaveSameBlockIdAs(received, otherChild) {
  3. const { id: thisId } = received;
  4. const { id: otherId } = otherChild;
  5. if (thisId === undefined || thisId === null) {
  6. return {
  7. message: 'expected block id not to be null or undefined',
  8. pass: false,
  9. };
  10. }
  11. if (otherId === undefined || otherId === null) {
  12. return {
  13. message: 'expected other block id not to be null or undefined',
  14. pass: false,
  15. };
  16. }
  17. return thisId === otherId
  18. ? {
  19. message: () =>
  20. `expected block id '${thisId}' not to match other id '${otherId}'`,
  21. pass: true,
  22. }
  23. : {
  24. message: () =>
  25. `expected block id '${thisId}' to match other id '${otherId}'`,
  26. pass: false,
  27. };
  28. },
  29. });