MCPcopy Create free account
hub / github.com/node-apn/node-apn / FakeStream

Function FakeStream

test/client.js:14–31  ·  view source on GitHub ↗
(deviceId, statusCode, response)

Source from the content-addressed store, hash-verified

12}
13
14function 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
33describe("Client", function () {
34 let fakes, Client;

Callers 1

client.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…