diff --git a/package.json b/package.json index 04b0269..709e568 100644 --- a/package.json +++ b/package.json @@ -28,10 +28,10 @@ "test": "tap ./test/*.js" }, "dependencies": { - "buffercursor": ">= 0.0.12", - "ipaddr.js": ">= 0.1.1" + "buffercursor": "0.0.12", + "ipaddr.js": "^1.1.0" }, "devDependencies": { - "tap": ">= 0.4.3" + "tap": "^5.4.2" } } diff --git a/packet.js b/packet.js index 56b17d9..036d87a 100644 --- a/packet.js +++ b/packet.js @@ -229,7 +229,7 @@ function writeQuestion(buff, val, label_index) { assert(val, 'Packet requires a question'); assertUndefined(val.name, 'Question requires a "name"'); assertUndefined(val.type, 'Question requires a "type"'); - assertUndefined(val.class, 'Questionn requires a "class"'); + assertUndefined(val.class, 'Question requires a "class"'); namePack(val.name, buff, label_index); buff.writeUInt16BE(val.type & 0xFFFF); buff.writeUInt16BE(val.class & 0xFFFF); diff --git a/test/parse.js b/test/parse.js index 13ffde5..f5fe483 100644 --- a/test/parse.js +++ b/test/parse.js @@ -17,7 +17,7 @@ files.forEach(function (file) { var js = 'foo = ' + fs.readFileSync(jsFile, 'utf8'); js = vm.runInThisContext(js, jsFile); var ret = Packet.parse(bin); - t.equivalent(ret, js); + t.same(ret, js, 'parsed packet equals fixture'); t.end(); }); }); diff --git a/test/write.js b/test/write.js index 48e1441..97d15cd 100644 --- a/test/write.js +++ b/test/write.js @@ -11,7 +11,7 @@ var fixtureDir = path.join(__dirname, 'fixtures'); var files = fs.readdirSync(fixtureDir).filter(function (f) { return /\.js$/.test(f); }); files.forEach(function (file) { - test('can parse ' + file, function (t) { + test('can write ' + file, function (t) { var js = 'foo = ' + fs.readFileSync(path.join(fixtureDir, file), 'utf8'); js = vm.runInThisContext(js, file); var buff = new Buffer(4096); @@ -19,9 +19,9 @@ files.forEach(function (file) { var binFile = path.join(fixtureDir, file.replace(/\.js$/, '.bin')); var bin = fs.readFileSync(binFile); var rtrip = Packet.parse(buff.slice(0, written)); - t.equivalent(written, bin.length, null, {testMsgLen: file}); - t.equivalent(buff.slice(0, written), bin, null, {testBin: file}); - t.equivalent(rtrip, js, null, {testObj: file}); + t.same(written, bin.length, 'output is of equal size to fixture'); + t.same(buff.slice(0, written), bin, 'output is equal to fixture'); + t.same(rtrip, js, 'reparsed output is equal to fixture'); t.end(); }); });