Skip to content
This repository
Browse code

failing unwritable test for a no-longer writable stream

  • Loading branch information...
commit ec2ead33b587ae16ccce617f7da84a7bce245dce 1 parent d63ff14
James Halliday authored June 09, 2012
6  example/https.js
@@ -6,7 +6,7 @@ var opts = {
6 6
 
7 7
 var bouncy = require('bouncy');
8 8
 bouncy(opts, function (req, bounce) {
9  
-    bounce(8000);
10  
-}).listen(7000);
  9
+    bounce(9000);
  10
+}).listen(7005);
11 11
 
12  
-console.log('https://localhost:7000');
  12
+console.log('https://localhost:7005');
2  package.json
@@ -34,7 +34,7 @@
34 34
         "morestreams" : "0.0.2"
35 35
     },
36 36
     "devDependencies" : {
37  
-        "tap" : "0.0.x",
  37
+        "tap" : "~0.2.5",
38 38
         "lazy" : "1.0.x",
39 39
         "websocket-server" : "1.4.x",
40 40
         "wsclient" : "0.2.x",
14  test/throw.js → test/unwritable.js
@@ -3,16 +3,17 @@ var bouncy = require('../');
3 3
 var http = require('http');
4 4
 var Stream = require('net').Stream;
5 5
 
6  
-test('write() that throws', function (t) {
  6
+test('write() on an unwritable stream', function (t) {
7 7
     var port = Math.floor(Math.random() * (Math.pow(2,16) - 1e4) + 1e4);
8  
-    t.plan(4);
  8
+    t.plan(1);
9 9
     var s = bouncy(function (req, bounce) {
10 10
         var stream = new Stream;
11 11
         stream.writable = true;
12 12
         stream.readable = true;
13 13
         
14 14
         stream.write = function (buf) {
15  
-            throw new Error('!');
  15
+            stream.writable = false;
  16
+            t.ok(true);
16 17
         };
17 18
         
18 19
         stream.end = function () {};
@@ -37,6 +38,13 @@ test('write() that throws', function (t) {
37 38
         };
38 39
         var req = http.request(opts);
39 40
         req.write('beep');
  41
+        setTimeout(function () {
  42
+            req.write('boop');
  43
+        }, 100);
40 44
         req.end();
41 45
     });
  46
+    
  47
+    t.on('end', function () {
  48
+        s.close();
  49
+    });
42 50
 });

0 notes on commit ec2ead3

Please sign in to comment.
Something went wrong with that request. Please try again.