From 49b588c7a6985bda494691bf2d72a82f545b5cf3 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 27 Sep 2017 14:40:51 -0600 Subject: [PATCH] pass json -> binary -> json test --- bin/dns-test.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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");