( expected: unknown, matcherName: string, options?: MatcherHintOptions, )
| 228 | }; |
| 229 | |
| 230 | export const ensureExpectedIsNonNegativeInteger = ( |
| 231 | expected: unknown, |
| 232 | matcherName: string, |
| 233 | options?: MatcherHintOptions, |
| 234 | ): void => { |
| 235 | if ( |
| 236 | typeof expected !== 'number' || |
| 237 | !Number.isSafeInteger(expected) || |
| 238 | expected < 0 |
| 239 | ) { |
| 240 | // Prepend maybe not only for backward compatibility. |
| 241 | const matcherString = (options ? '' : '[.not]') + matcherName; |
| 242 | throw new Error( |
| 243 | matcherErrorMessage( |
| 244 | matcherHint(matcherString, undefined, undefined, options), |
| 245 | `${EXPECTED_COLOR('expected')} value must be a non-negative integer`, |
| 246 | printWithType('Expected', expected, printExpected), |
| 247 | ), |
| 248 | ); |
| 249 | } |
| 250 | }; |
| 251 | |
| 252 | // Given array of diffs, return concatenated string: |
| 253 | // * include common substrings |
no test coverage detected