(actual, expected, msg = '')
| 79 | } |
| 80 | |
| 81 | export function assertArrayEqual(actual, expected, msg = '') { |
| 82 | if (actual.length !== expected.length) { |
| 83 | throw new Error(`${formatMsg(msg)}expected: array.length ${expected.length} to equal actual.length: ${actual.length}`); |
| 84 | } |
| 85 | const errors = []; |
| 86 | for (let i = 0; i < actual.length; ++i) { |
| 87 | if (actual[i] !== expected[i]) { |
| 88 | errors.push(`${formatMsg(msg)}expected: expected[${i}] ${expected[i]} to equal actual[${i}]: ${actual[i]}`); |
| 89 | if (errors.length === 10) { |
| 90 | break; |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | if (errors.length > 0) { |
| 95 | throw new Error(errors.join('\n')); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | export function assertThrowsWith(func, expectations, msg = '') { |
| 100 | let error = ''; |
no test coverage detected