(assert: test.Test)
| 221 | // ========================================================= |
| 222 | |
| 223 | function makeRecursiveCheck(assert: test.Test) { |
| 224 | return function (map1: any, map2: any, msg: string) { |
| 225 | var equal = true; |
| 226 | |
| 227 | var equal = checkRecursively(map1, map2); |
| 228 | |
| 229 | assert.ok(equal, msg); |
| 230 | |
| 231 | // deepEqual doesn't work with fields using node-int64 |
| 232 | function checkRecursively(map1: any, map2: any): boolean { |
| 233 | if (!(typeof map1 !== "function" && typeof map2 !== "function")) { |
| 234 | return false; |
| 235 | } |
| 236 | if (!map1 || typeof map1 !== "object") { |
| 237 | //Handle int64 types (which use node-int64 in Node.js JavaScript) |
| 238 | if ( |
| 239 | typeof map1 === "number" && |
| 240 | typeof map2 === "object" && |
| 241 | map2.buffer && |
| 242 | map2.buffer instanceof Buffer && |
| 243 | map2.buffer.length === 8 |
| 244 | ) { |
| 245 | var n = new Int64(map2.buffer); |
| 246 | return map1 === n.toNumber(); |
| 247 | } else { |
| 248 | return map1 == map2; |
| 249 | } |
| 250 | } else { |
| 251 | return Object.keys(map1).every(function (key) { |
| 252 | return checkRecursively(map1[key], map2[key]); |
| 253 | }); |
| 254 | } |
| 255 | } |
| 256 | }; |
| 257 | } |
| 258 | |
| 259 | function checkOffByOne( |
| 260 | done: (callback: () => void) => void, |
no test coverage detected