MCPcopy Create free account
hub / github.com/PageLeay/celestial-runtime / assertObj

Function assertObj

lib.commonjs/_tests/test-providers-data.js:103–124  ·  view source on GitHub ↗
(prefix, actual, expected)

Source from the content-addressed store, hash-verified

101 });
102});
103function assertObj(prefix, actual, expected) {
104 assert_1.default.ok(actual != null, `${prefix} is null`);
105 if (typeof (expected) !== "object") {
106 assert_1.default.equal(actual, expected, prefix);
107 return;
108 }
109 for (const key in expected) {
110 if (expected[key] === undefined) {
111 continue;
112 }
113 if (Array.isArray(expected[key])) {
114 assert_1.default.ok(Array.isArray(actual[key]), `Array.isArray(${prefix}.${key})`);
115 assert_1.default.equal(actual[key].length, expected[key].length, `${prefix}.${key}.length`);
116 for (let i = 0; i < expected[key].length; i++) {
117 assertObj(`${prefix}[${i}]`, actual[key][i], expected[key][i]);
118 }
119 }
120 else {
121 assert_1.default.equal(actual[key], expected[key], `${prefix}.${key}`);
122 }
123 }
124}
125function assertBlock(actual, expected) {
126 // Check transactions
127 for (let i = 0; i < expected.transactions.length; i++) {

Callers 3

assertBlockFunction · 0.70
assertTransactionFunction · 0.70
assertReceiptFunction · 0.70

Calls 2

okMethod · 0.45
isArrayMethod · 0.45

Tested by

no test coverage detected