bunch of changes

This commit is contained in:
Yaroslav Kukharuk
2021-02-24 13:55:49 +02:00
parent 7003f4cfe6
commit cf0679fa0b
10 changed files with 78 additions and 1201 deletions
+9 -3
View File
@@ -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();
});
});
});