Skip to content

Commit 8eb2c47

Browse files
committed
[test] Fix nits
1 parent 5299b0e commit 8eb2c47

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

test/websocket.test.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('WebSocket', () => {
6161
});
6262

6363
it('accepts `url.URL` objects as url', (done) => {
64-
const agent = new CustomAgent();
64+
const agent = new http.Agent();
6565

6666
agent.addRequest = (req, opts) => {
6767
assert.strictEqual(opts.host, '::1');
@@ -74,7 +74,7 @@ describe('WebSocket', () => {
7474

7575
describe('options', () => {
7676
it('accepts the `options` object as 3rd argument', () => {
77-
const agent = new CustomAgent();
77+
const agent = new http.Agent();
7878
let count = 0;
7979
let ws;
8080

@@ -122,10 +122,8 @@ describe('WebSocket', () => {
122122
});
123123

124124
it('throws an error when using an invalid `protocolVersion`', () => {
125-
const options = { agent: new CustomAgent(), protocolVersion: 1000 };
126-
127125
assert.throws(
128-
() => new WebSocket('ws://localhost', options),
126+
() => new WebSocket('ws://localhost', { protocolVersion: 1000 }),
129127
/^RangeError: Unsupported protocol version: 1000 \(supported versions: 8, 13\)$/
130128
);
131129
});
@@ -3709,7 +3707,7 @@ describe('WebSocket', () => {
37093707

37103708
describe('Request headers', () => {
37113709
it('adds the authorization header if the url has userinfo', (done) => {
3712-
const agent = new CustomAgent();
3710+
const agent = new http.Agent();
37133711
const userinfo = 'test:testpass';
37143712

37153713
agent.addRequest = (req) => {
@@ -3724,7 +3722,7 @@ describe('WebSocket', () => {
37243722
});
37253723

37263724
it('honors the `auth` option', (done) => {
3727-
const agent = new CustomAgent();
3725+
const agent = new http.Agent();
37283726
const auth = 'user:pass';
37293727

37303728
agent.addRequest = (req) => {
@@ -3739,7 +3737,7 @@ describe('WebSocket', () => {
37393737
});
37403738

37413739
it('favors the url userinfo over the `auth` option', (done) => {
3742-
const agent = new CustomAgent();
3740+
const agent = new http.Agent();
37433741
const auth = 'foo:bar';
37443742
const userinfo = 'baz:qux';
37453743

@@ -3755,7 +3753,7 @@ describe('WebSocket', () => {
37553753
});
37563754

37573755
it('adds custom headers', (done) => {
3758-
const agent = new CustomAgent();
3756+
const agent = new http.Agent();
37593757

37603758
agent.addRequest = (req) => {
37613759
assert.strictEqual(req.getHeader('cookie'), 'foo=bar');
@@ -3784,7 +3782,7 @@ describe('WebSocket', () => {
37843782
});
37853783

37863784
it("doesn't add the origin header by default", (done) => {
3787-
const agent = new CustomAgent();
3785+
const agent = new http.Agent();
37883786

37893787
agent.addRequest = (req) => {
37903788
assert.strictEqual(req.getHeader('origin'), undefined);
@@ -3795,7 +3793,7 @@ describe('WebSocket', () => {
37953793
});
37963794

37973795
it('honors the `origin` option (1/2)', (done) => {
3798-
const agent = new CustomAgent();
3796+
const agent = new http.Agent();
37993797

38003798
agent.addRequest = (req) => {
38013799
assert.strictEqual(req.getHeader('origin'), 'https://example.com:8000');
@@ -3809,7 +3807,7 @@ describe('WebSocket', () => {
38093807
});
38103808

38113809
it('honors the `origin` option (2/2)', (done) => {
3812-
const agent = new CustomAgent();
3810+
const agent = new http.Agent();
38133811

38143812
agent.addRequest = (req) => {
38153813
assert.strictEqual(
@@ -3860,7 +3858,7 @@ describe('WebSocket', () => {
38603858

38613859
describe('permessage-deflate', () => {
38623860
it('is enabled by default', (done) => {
3863-
const agent = new CustomAgent();
3861+
const agent = new http.Agent();
38643862

38653863
agent.addRequest = (req) => {
38663864
assert.strictEqual(
@@ -3874,7 +3872,7 @@ describe('WebSocket', () => {
38743872
});
38753873

38763874
it('can be disabled', (done) => {
3877-
const agent = new CustomAgent();
3875+
const agent = new http.Agent();
38783876

38793877
agent.addRequest = (req) => {
38803878
assert.strictEqual(
@@ -3891,7 +3889,7 @@ describe('WebSocket', () => {
38913889
});
38923890

38933891
it('can send extension parameters', (done) => {
3894-
const agent = new CustomAgent();
3892+
const agent = new http.Agent();
38953893

38963894
const value =
38973895
'permessage-deflate; server_no_context_takeover;' +

0 commit comments

Comments
 (0)