diff --git a/bin/dns-test.js b/bin/dns-test.js index 6fc2aef..f10d8d7 100644 --- a/bin/dns-test.js +++ b/bin/dns-test.js @@ -61,8 +61,8 @@ function testBinAsync(nb) { process.exit(38); return; } - var bin = dnsjs.write(json); - var json2 = dnsjs.parse(bin); + var bin2 = dnsjs.write(json); + var json2 = dnsjs.parse(bin2); if (json2.error) { console.error(json2); process.exit(37); @@ -70,7 +70,20 @@ function testBinAsync(nb) { } var assert = require('assert'); - json = JSON.parse(JSON.stringify()); + // EXPLANATION: + // The strategy used for compression pointers has not yet been proven + // as deterministic... and we don't implement them anyway, so this may not be the same + json = JSON.parse(JSON.stringify(json) + .replace(/,"labels":.*?\]/, '') + .replace(/,"cpcount":\d+/, '') + ); + json2 = JSON.parse(JSON.stringify(json2) + .replace(/,"labels":.*?\]/, '') + .replace(/,"cpcount":\d+/, '') + ); + //json2 = JSON.parse(JSON.stringify(json2)); + //console.log(json); + //console.log(json2); assert.deepEqual(json, json2); console.log("[OK] binary -> JSON -> binary -> JSON");