Skip to content

Commit c3c70fe

Browse files
committed
Fixed failing test case on node < 6
1 parent 66be598 commit c3c70fe

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tests/base64.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ tape.test("base64", function(test) {
2323
var len2 = protobuf.util.decode64(enc, buf, 0);
2424
test.equal(len2, len, "should decode '" + enc + "' to " + len + " bytes");
2525

26-
if (protobuf.util.isNode) {
27-
var comp = global.Buffer.from(buf).toString("utf8");
28-
test.equal(comp, str, "should decode '" + enc + "' to '" + str + "'");
29-
}
26+
if (protobuf.util.isNode && protobuf.util.Buffer)
27+
test.equal(buf.toString("utf8"), str, "should decode '" + enc + "' to '" + str + "'");
3028

3129
var enc2 = protobuf.util.encode64(buf, 0, buf.length);
3230
test.equal(enc2, enc, "should encode '" + str + "' to '" + enc + "'");

0 commit comments

Comments
 (0)