/* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Recursively compare two objects and check that every property of expectedObj has the same value * on actualObj. */ function isSubObjectOf(expectedObj, actualObj, name) { for (let prop in expectedObj) { if (typeof expectedObj[prop] == 'function') continue; if (expectedObj[prop] instanceof Object) { is(actualObj[prop].length, expectedObj[prop].length, name + "[" + prop + "]"); isSubObjectOf(expectedObj[prop], actualObj[prop], name + "[" + prop + "]"); } else { is(actualObj[prop], expectedObj[prop], name + "[" + prop + "]"); } } }