bunch of changes
This commit is contained in:
+9
-3
@@ -4,7 +4,7 @@ import { Duplex } from 'stream';
|
||||
import WebSocket from 'ws';
|
||||
import net from 'net';
|
||||
|
||||
import Client from './Client';
|
||||
import Client from './Client.js';
|
||||
|
||||
class DummySocket extends Duplex {
|
||||
constructor(options) {
|
||||
@@ -57,12 +57,17 @@ class DummyAgent extends http.Agent {
|
||||
}
|
||||
|
||||
createConnection(options, cb) {
|
||||
cb(null, new DummySocket());
|
||||
const soc = new DummySocket();
|
||||
// console.log( 'QWEQWEQE', options, cb);
|
||||
cb(null, soc);
|
||||
return soc
|
||||
}
|
||||
}
|
||||
|
||||
describe('Client', () => {
|
||||
it('should handle request', async () => {
|
||||
console.log('!!!!!!', 'qwfqwfwqfw');
|
||||
|
||||
const agent = new DummyAgent();
|
||||
const client = new Client({ agent });
|
||||
|
||||
@@ -85,6 +90,7 @@ describe('Client', () => {
|
||||
});
|
||||
req.end();
|
||||
});
|
||||
console.log(res.headers)
|
||||
assert.equal(res.headers['x-powered-by'], 'dummy');
|
||||
server.close();
|
||||
});
|
||||
@@ -154,4 +160,4 @@ describe('Client', () => {
|
||||
netClient.destroy();
|
||||
server.close();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user