Skip to content

Commit 2fac7b9

Browse files
committedAug 26, 2013
[test] added the lib/caronte/streams/forward.js initial test, one test pending
1 parent c02b721 commit 2fac7b9

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed
 

Diff for: ‎lib/caronte/streams/forward.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ function ForwardStream(options) {
2424
var self = this;
2525

2626
self.options = options;
27-
self.res = res;
27+
// To uncomment the line below, please see
28+
// https://github.com/yawnt/caronte/commit/9ab8749a9bec33b49c495975e8364336ad7be1a3#commitcomment-3947117
29+
//self.res = res;
2830

2931
Writable.call(this);
3032

Diff for: ‎test/lib-caronte-streams-forward-test.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
var ForwardStream = require('../lib/caronte/streams/forward'),
2+
expect = require('expect.js'),
3+
Writable = require('stream').Writable,
4+
http = require('http');
5+
6+
7+
describe('lib/caronte/passes/web.js', function () {
8+
describe('forward stream constructor', function () {
9+
it('should be an instance of Writable stream and get the correct options and methods', function () {
10+
var stubOptions = {
11+
key: 'value'
12+
};
13+
var forwardProxy = new ForwardStream(stubOptions);
14+
15+
expect(forwardProxy).to.be.a(Writable);
16+
expect(forwardProxy.options).to.eql({ key: 'value' });
17+
expect(forwardProxy.onPipe).to.be.a('function');
18+
expect(forwardProxy.onFinish).to.be.a('function');
19+
expect(forwardProxy._events).to.have.property('pipe');
20+
expect(forwardProxy._events).to.have.property('finish');
21+
});
22+
});
23+
24+
describe('should pipe the request and finish it', function () {
25+
it('should make the request on pipe and finish it');
26+
var stubOptions = {
27+
target: {
28+
hostname : 'www.google.com',
29+
port : '80',
30+
path : '/'
31+
}
32+
};
33+
34+
var forwardProxy = new ForwardStream({});
35+
36+
});
37+
});

0 commit comments

Comments
 (0)