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

Function assertDeepSuperset

apps/automated/src/tk-unit.ts:262–277  ·  view source on GitHub ↗
(actual, expected, path: any[] = [])

Source from the content-addressed store, hash-verified

260}
261
262export function assertDeepSuperset(actual, expected, path: any[] = []): void {
263 let typeofActual: string = typeof actual;
264 let typeofExpected: string = typeof expected;
265 if (typeofActual !== typeofExpected) {
266 throw new Error('At /' + path.join('/') + ' types of actual ' + typeofActual + ' and expected ' + typeofExpected + ' differ.');
267 } else if (typeofActual === 'object' || typeofActual === 'array') {
268 for (let key in expected) {
269 if (!(key in actual)) {
270 throw new Error('At /' + path.join('/') + ' expected a key ' + key + '.');
271 }
272 assertDeepSuperset(actual[key], expected[key], path.concat([key]));
273 }
274 } else if (actual !== expected) {
275 throw new Error('At /' + path.join('/') + " actual: '" + actual + "' and expected: '" + expected + "' differ.");
276 }
277}
278
279export function assertNull(actual: any, message?: string) {
280 if (actual !== null && actual !== undefined) {

Callers

nothing calls this directly

Calls 2

joinMethod · 0.80
concatMethod · 0.80

Tested by

no test coverage detected