(deviceId, statusCode, response)
| 12 | } |
| 13 | |
| 14 | function FakeStream(deviceId, statusCode, response) { |
| 15 | const fakeStream = new stream.Transform({ |
| 16 | transform: sinon.spy(function(chunk, encoding, callback) { |
| 17 | expect(this.headers).to.be.calledOnce; |
| 18 | |
| 19 | const headers = this.headers.firstCall.args[0]; |
| 20 | expect(headers[":path"].substring(10)).to.equal(deviceId); |
| 21 | |
| 22 | this.emit("headers", { |
| 23 | ":status": statusCode |
| 24 | }); |
| 25 | callback(null, Buffer.from(JSON.stringify(response) || "")); |
| 26 | }) |
| 27 | }); |
| 28 | fakeStream.headers = sinon.stub(); |
| 29 | |
| 30 | return fakeStream; |
| 31 | } |
| 32 | |
| 33 | describe("Client", function () { |
| 34 | let fakes, Client; |
no outgoing calls
no test coverage detected
searching dependent graphs…