@relaycorp/ws-mock
Advanced tools
Comparing version 5.2.6 to 5.2.7
@@ -9,2 +9,7 @@ "use strict"; | ||
class MockClient extends MockPeer_1.MockPeer { | ||
wsServer; | ||
headers; | ||
url; | ||
socket; | ||
connected = false; | ||
constructor(wsServer, headers = {}, url = '/') { | ||
@@ -15,3 +20,2 @@ super(); | ||
this.url = url; | ||
this.connected = false; | ||
this.socket = new net_1.Socket(); | ||
@@ -18,0 +22,0 @@ // TODO: Propagate error somehow, instead of silencing it |
@@ -11,5 +11,6 @@ "use strict"; | ||
class MockPeer { | ||
peerWebSocket; | ||
ownCloseFrame = null; | ||
wasAborted = false; | ||
constructor() { | ||
this.ownCloseFrame = null; | ||
this.wasAborted = false; | ||
this.peerWebSocket = new MockWebSocket_1.MockWebSocket(() => { | ||
@@ -16,0 +17,0 @@ if (!this.ownCloseFrame) { |
@@ -9,17 +9,22 @@ "use strict"; | ||
class MockWebSocket extends events_1.EventEmitter { | ||
closingHandshakeCallback; | ||
static CONNECTING = READY_STATES.indexOf('CONNECTING'); | ||
static OPEN = READY_STATES.indexOf('OPEN'); | ||
static CLOSING = READY_STATES.indexOf('CLOSING'); | ||
static CLOSED = READY_STATES.indexOf('CLOSED'); | ||
CONNECTING = MockWebSocket.CONNECTING; | ||
OPEN = MockWebSocket.OPEN; | ||
CLOSING = MockWebSocket.CLOSING; | ||
CLOSED = MockWebSocket.CLOSED; | ||
binaryType = 'nodebuffer'; | ||
outgoingPings = []; | ||
outgoingPongs = []; | ||
_readyState = MockWebSocket.CONNECTING; | ||
ownCloseFrame = null; | ||
_wasTerminated = false; | ||
messagesSent = []; | ||
ownEvents = new events_1.EventEmitter(); | ||
constructor(closingHandshakeCallback) { | ||
super(); | ||
this.closingHandshakeCallback = closingHandshakeCallback; | ||
this.CONNECTING = MockWebSocket.CONNECTING; | ||
this.OPEN = MockWebSocket.OPEN; | ||
this.CLOSING = MockWebSocket.CLOSING; | ||
this.CLOSED = MockWebSocket.CLOSED; | ||
this.binaryType = 'nodebuffer'; | ||
this.outgoingPings = []; | ||
this.outgoingPongs = []; | ||
this._readyState = MockWebSocket.CONNECTING; | ||
this.ownCloseFrame = null; | ||
this._wasTerminated = false; | ||
this.messagesSent = []; | ||
this.ownEvents = new events_1.EventEmitter(); | ||
this.once('open', () => { | ||
@@ -139,6 +144,2 @@ this._readyState = MockWebSocket.OPEN; | ||
exports.MockWebSocket = MockWebSocket; | ||
MockWebSocket.CONNECTING = READY_STATES.indexOf('CONNECTING'); | ||
MockWebSocket.OPEN = READY_STATES.indexOf('OPEN'); | ||
MockWebSocket.CLOSING = READY_STATES.indexOf('CLOSING'); | ||
MockWebSocket.CLOSED = READY_STATES.indexOf('CLOSED'); | ||
async function waitForEvent(eventName, eventEmitter) { | ||
@@ -145,0 +146,0 @@ return new Promise((resolve) => eventEmitter.once(eventName, resolve)); |
{ | ||
"name": "@relaycorp/ws-mock", | ||
"version": "5.2.6", | ||
"version": "5.2.7", | ||
"author": { | ||
@@ -28,3 +28,3 @@ "email": "no-reply@relaycorp.tech", | ||
"cov": "run-s build test:unit && opn coverage/lcov-report/index.html", | ||
"doc-api": "typedoc src/index.ts --out build/docs/api", | ||
"doc-api": "typedoc src/index.ts --out build/docs", | ||
"clean": "del-cli build test" | ||
@@ -37,3 +37,3 @@ }, | ||
"buffer-to-arraybuffer": "0.0.6", | ||
"ws": "^8.13.0" | ||
"ws": "^8.14.2" | ||
}, | ||
@@ -44,10 +44,10 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@relaycorp/shared-config": "^1.9.1", | ||
"@types/ws": "^8.5.4", | ||
"del-cli": "^5.0.0", | ||
"@relaycorp/shared-config": "^1.14.1", | ||
"@types/ws": "^8.5.6", | ||
"del-cli": "^5.1.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.8.4", | ||
"prettier": "^3.0.3", | ||
"ts-node": "^10.9.1", | ||
"tslint": "^6.1.3", | ||
"typedoc": "^0.23.26", | ||
"typedoc": "^0.25.1", | ||
"typescript": "^4.8.2" | ||
@@ -54,0 +54,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
400533
65
2577
6
Updatedws@^8.14.2