MCPcopy
hub / github.com/axios/axios / createFakeSession

Function createFakeSession

tests/unit/helpers/Http2Sessions.test.js:6–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import Http2Sessions from '../../../lib/helpers/Http2Sessions.js';
5
6function createFakeSession() {
7 const session = new EventEmitter();
8 session.destroyed = false;
9 session.closed = false;
10 session.close = vi.fn(() => {
11 session.closed = true;
12 session.emit('close');
13 });
14 const originalRequest = vi.fn(() => {
15 const stream = new EventEmitter();
16 stream.endStream = vi.fn();
17 return stream;
18 });
19 session.request = originalRequest;
20 session._originalRequest = originalRequest;
21 return session;
22}
23
24describe('helpers::Http2Sessions', () => {
25 let connectSpy;

Callers 1

Calls 1

emitMethod · 0.80

Tested by

no test coverage detected