From c3c70fe3a47fd4f7c85dc80e1af7d9403fe349cd Mon Sep 17 00:00:00 2001 From: dcodeIO Date: Sat, 10 Dec 2016 14:05:09 +0100 Subject: [PATCH] Fixed failing test case on node < 6 --- tests/base64.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/base64.js b/tests/base64.js index a538de2c0..8cddd1962 100644 --- a/tests/base64.js +++ b/tests/base64.js @@ -23,10 +23,8 @@ tape.test("base64", function(test) { var len2 = protobuf.util.decode64(enc, buf, 0); test.equal(len2, len, "should decode '" + enc + "' to " + len + " bytes"); - if (protobuf.util.isNode) { - var comp = global.Buffer.from(buf).toString("utf8"); - test.equal(comp, str, "should decode '" + enc + "' to '" + str + "'"); - } + if (protobuf.util.isNode && protobuf.util.Buffer) + test.equal(buf.toString("utf8"), str, "should decode '" + enc + "' to '" + str + "'"); var enc2 = protobuf.util.encode64(buf, 0, buf.length); test.equal(enc2, enc, "should encode '" + str + "' to '" + enc + "'");