MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / arrayAssert

Function arrayAssert

apps/automated/src/tk-unit.ts:311–321  ·  view source on GitHub ↗
(actual: Array<any>, expected: Array<any>, message?: string)

Source from the content-addressed store, hash-verified

309}
310
311export function arrayAssert(actual: Array<any>, expected: Array<any>, message?: string) {
312 if (actual.length !== expected.length) {
313 throw new Error(message + ' Actual array length: ' + actual.length + ' Expected array length: ' + expected.length);
314 }
315
316 for (let i = 0; i < actual.length; i++) {
317 if (actual[i] !== expected[i]) {
318 throw new Error(message + ' Actual element at ' + i + ' is: ' + actual[i] + ' Expected element is: ' + expected[i]);
319 }
320 }
321}
322
323export function assertThrows(testFunc: () => void, assertMessage?: string, expectedMessage?: string) {
324 const re = expectedMessage ? new RegExp(`^${expectedMessage}$`) : null;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected