Permalink
Browse files

Add semicolons and blocks to mock Writable Stream.

  • Loading branch information...
1 parent 74938bc commit b16ce478b7233e636eb7666841c42b8d22887b07 @reid committed Nov 18, 2011
Showing with 15 additions and 5 deletions.
  1. +15 −5 test/lib/writable-stream.js
@@ -24,23 +24,33 @@ module.exports = function () {
function MockWritableStream () {
this.$store = "";
}
+
var proto = MockWritableStream.prototype;
+
proto.writeHead = function (status, /* msg, */ headers) {
this.$status = status;
this.$headers = headers;
};
+
proto.end = function (input) {
- if (input) this.write(input);
+ if (input) {
+ this.write(input);
+ }
this.$end = true;
};
+
proto.write = function (input) {
- if (this.$end) throw new Error("Unable to write: closed.");
+ if (this.$end) {
+ throw new Error("Unable to write: closed.");
+ }
+
if (Buffer.isBuffer(input)) {
this.$store += input.toString("utf8");
} else {
this.$store += input;
}
};
- return new MockWritableStream;
- }
-}
+
+ return new MockWritableStream();
+ };
+};

0 comments on commit b16ce47

Please sign in to comment.