( label: string, received: Function, expected: Function, )
| 102 | |
| 103 | // Do not call function if received is equal to expected. |
| 104 | export const printReceivedConstructorNameNot = ( |
| 105 | label: string, |
| 106 | received: Function, |
| 107 | expected: Function, |
| 108 | ): string => |
| 109 | typeof expected.name === 'string' && |
| 110 | expected.name.length > 0 && |
| 111 | typeof received.name === 'string' && |
| 112 | received.name.length > 0 |
| 113 | ? `${printConstructorName(label, received, true, false)} ${ |
| 114 | Object.getPrototypeOf(received) === expected |
| 115 | ? 'extends' |
| 116 | : 'extends … extends' |
| 117 | } ${EXPECTED_COLOR(expected.name)}\n` |
| 118 | : `${printConstructorName(label, received, false, false)}\n`; |
| 119 | |
| 120 | const printConstructorName = ( |
| 121 | label: string, |
no test coverage detected