MCPcopy Create free account
hub / github.com/apache/thrift / makeRecursiveCheck

Function makeRecursiveCheck

lib/nodejs/test/test_driver.mjs:279–310  ·  view source on GitHub ↗
(assert)

Source from the content-addressed store, hash-verified

277// =========================================================
278
279function makeRecursiveCheck(assert) {
280 return function (map1, map2, msg) {
281 const equal = checkRecursively(map1, map2);
282
283 assert.ok(equal, msg);
284
285 // deepEqual doesn't work with fields using node-int64
286 function checkRecursively(map1, map2) {
287 if (typeof map1 !== "function" && typeof map2 !== "function") {
288 if (!map1 || typeof map1 !== "object") {
289 //Handle int64 types (which use node-int64 in Node.js JavaScript)
290 if (
291 typeof map1 === "number" &&
292 typeof map2 === "object" &&
293 map2.buffer &&
294 map2.buffer instanceof Buffer &&
295 map2.buffer.length === 8
296 ) {
297 const n = new Int64(map2.buffer);
298 return map1 === n.toNumber();
299 } else {
300 return map1 == map2;
301 }
302 } else {
303 return Object.keys(map1).every(function (key) {
304 return checkRecursively(map1[key], map2[key]);
305 });
306 }
307 }
308 }
309 };
310}
311
312function checkOffByOne(done, callback) {
313 const retry_limit = 30;

Callers 2

ThriftTestDriverFunction · 0.70
ThriftTestDriverPromiseFunction · 0.70

Calls 1

checkRecursivelyFunction · 0.70

Tested by

no test coverage detected