@wutiange/log-listener-plugin 1.3.0-alpha.3 → 1.3.0-alpha.6
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +201 -201
- package/README.md +10 -2
- package/dist/src/HTTPInterceptor.d.ts +3 -2
- package/dist/src/HTTPInterceptor.js +29 -8
- package/dist/src/HTTPInterceptor.js.map +1 -1
- package/dist/src/{server.d.ts → Server.d.ts} +1 -0
- package/dist/src/{server.js → Server.js} +5 -2
- package/dist/src/Server.js.map +1 -0
- package/dist/src/__mocks__/react-native/Libraries/Blob/FileReader.d.ts +14 -0
- package/dist/src/__mocks__/react-native/Libraries/Blob/FileReader.js +42 -0
- package/dist/src/__mocks__/react-native/Libraries/Blob/FileReader.js.map +1 -0
- package/dist/src/__mocks__/react-native/Libraries/Network/XHRInterceptor.d.ts +17 -0
- package/dist/src/__mocks__/react-native/Libraries/Network/XHRInterceptor.js +35 -0
- package/dist/src/__mocks__/react-native/Libraries/Network/XHRInterceptor.js.map +1 -0
- package/dist/src/__tests__/HTTPInterceptor.test.d.ts +9 -0
- package/dist/src/__tests__/HTTPInterceptor.test.js +281 -0
- package/dist/src/__tests__/HTTPInterceptor.test.js.map +1 -0
- package/dist/src/__tests__/Server.test.d.ts +1 -0
- package/dist/src/__tests__/Server.test.js +155 -0
- package/dist/src/__tests__/Server.test.js.map +1 -0
- package/dist/src/__tests__/utils.test.d.ts +1 -0
- package/dist/src/__tests__/utils.test.js +108 -0
- package/dist/src/__tests__/utils.test.js.map +1 -0
- package/dist/src/logPlugin.d.ts +2 -1
- package/dist/src/logPlugin.js +13 -8
- package/dist/src/logPlugin.js.map +1 -1
- package/dist/src/utils.d.ts +4 -1
- package/dist/src/utils.js +75 -12
- package/dist/src/utils.js.map +1 -1
- package/package.json +54 -49
- package/console.ts +0 -21
- package/dist/src/__tests__/console.test.d.ts +0 -1
- package/dist/src/__tests__/console.test.js +0 -29
- package/dist/src/__tests__/console.test.js.map +0 -1
- package/dist/src/server.js.map +0 -1
- package/fetch.ts +0 -39
- package/index.ts +0 -3
- package/src/HTTPInterceptor.ts +0 -319
- package/src/__tests__/console.test.ts +0 -26
- package/src/common.ts +0 -4
- package/src/logPlugin.ts +0 -238
- package/src/server.ts +0 -66
- package/src/utils.ts +0 -47
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
class FileReader {
|
4
|
+
constructor() {
|
5
|
+
this.result = null;
|
6
|
+
this.error = null;
|
7
|
+
this.readyState = FileReader.EMPTY;
|
8
|
+
}
|
9
|
+
addEventListener(event, callback) {
|
10
|
+
this[`on${event}`] = callback;
|
11
|
+
}
|
12
|
+
removeEventListener(event, callback) {
|
13
|
+
if (this[`on${event}`] === callback) {
|
14
|
+
this[`on${event}`] = null;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
readAsText(blob) {
|
18
|
+
this._read(blob, 'text');
|
19
|
+
}
|
20
|
+
readAsArrayBuffer(blob) {
|
21
|
+
this._read(blob, 'arraybuffer');
|
22
|
+
}
|
23
|
+
_read(blob, resultType) {
|
24
|
+
this.readyState = FileReader.LOADING;
|
25
|
+
setTimeout(() => {
|
26
|
+
this.readyState = FileReader.DONE;
|
27
|
+
if (resultType === 'text') {
|
28
|
+
this.result = blob.text();
|
29
|
+
}
|
30
|
+
else if (resultType === 'arraybuffer') {
|
31
|
+
this.result = new ArrayBuffer(0);
|
32
|
+
}
|
33
|
+
if (this.onload)
|
34
|
+
this.onload({ target: this });
|
35
|
+
}, 0);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
FileReader.EMPTY = 0;
|
39
|
+
FileReader.LOADING = 1;
|
40
|
+
FileReader.DONE = 2;
|
41
|
+
module.exports = FileReader;
|
42
|
+
//# sourceMappingURL=FileReader.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FileReader.js","sourceRoot":"","sources":["../../../../../../src/__mocks__/react-native/Libraries/Blob/FileReader.js"],"names":[],"mappings":";;AAAA,MAAM,UAAU;I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K,GAAG,CAAC,CAAC;AACV,kBAAO,GAAG,CAAC,CAAC;AACZ,eAAI,GAAG,CAAC,CAAC;AAmClB,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export = XHRInterceptor;
|
2
|
+
declare class XHRInterceptor {
|
3
|
+
static _isInterceptorEnabled: boolean;
|
4
|
+
static openCallback: any;
|
5
|
+
static requestHeaderCallback: any;
|
6
|
+
static headerReceivedCallback: any;
|
7
|
+
static sendCallback: any;
|
8
|
+
static responseCallback: any;
|
9
|
+
static setOpenCallback: jest.Mock<void, [callback?: any], any>;
|
10
|
+
static setRequestHeaderCallback: jest.Mock<void, [callback?: any], any>;
|
11
|
+
static setHeaderReceivedCallback: jest.Mock<void, [callback?: any], any>;
|
12
|
+
static setSendCallback: jest.Mock<void, [callback?: any], any>;
|
13
|
+
static setResponseCallback: jest.Mock<void, [callback?: any], any>;
|
14
|
+
static enableInterception: jest.Mock<void, [], any>;
|
15
|
+
static disableInterception: jest.Mock<void, [], any>;
|
16
|
+
static isInterceptorEnabled: jest.Mock<boolean, [], any>;
|
17
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
class XHRInterceptor {
|
4
|
+
}
|
5
|
+
XHRInterceptor._isInterceptorEnabled = false;
|
6
|
+
XHRInterceptor.openCallback = null;
|
7
|
+
XHRInterceptor.requestHeaderCallback = null;
|
8
|
+
XHRInterceptor.headerReceivedCallback = null;
|
9
|
+
XHRInterceptor.sendCallback = null;
|
10
|
+
XHRInterceptor.responseCallback = null;
|
11
|
+
XHRInterceptor.setOpenCallback = jest.fn((callback) => {
|
12
|
+
XHRInterceptor.openCallback = callback;
|
13
|
+
});
|
14
|
+
XHRInterceptor.setRequestHeaderCallback = jest.fn((callback) => {
|
15
|
+
XHRInterceptor.requestHeaderCallback = callback;
|
16
|
+
});
|
17
|
+
XHRInterceptor.setHeaderReceivedCallback = jest.fn((callback) => {
|
18
|
+
XHRInterceptor.headerReceivedCallback = callback;
|
19
|
+
});
|
20
|
+
XHRInterceptor.setSendCallback = jest.fn((callback) => {
|
21
|
+
XHRInterceptor.sendCallback = callback;
|
22
|
+
});
|
23
|
+
XHRInterceptor.setResponseCallback = jest.fn((callback) => {
|
24
|
+
XHRInterceptor.responseCallback = callback;
|
25
|
+
});
|
26
|
+
XHRInterceptor.enableInterception = jest.fn(() => {
|
27
|
+
XHRInterceptor._isInterceptorEnabled = true;
|
28
|
+
});
|
29
|
+
XHRInterceptor.disableInterception = jest.fn(() => {
|
30
|
+
XHRInterceptor._isInterceptorEnabled = false;
|
31
|
+
});
|
32
|
+
XHRInterceptor.isInterceptorEnabled = jest.fn(() => XHRInterceptor._isInterceptorEnabled);
|
33
|
+
;
|
34
|
+
module.exports = XHRInterceptor;
|
35
|
+
//# sourceMappingURL=XHRInterceptor.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"XHRInterceptor.js","sourceRoot":"","sources":["../../../../../../src/__mocks__/react-native/Libraries/Network/XHRInterceptor.js"],"names":[],"mappings":";;AAEA,MAAM,cAAc;;AACX,oCAAqB,GAAG,KAAK,CAAA;AAC7B,2BAAY,GAAG,IAAI,CAAA;AACnB,oCAAqB,GAAG,IAAI,CAAA;AAC5B,qCAAsB,GAAG,IAAI,CAAA;AAC7B,2BAAY,GAAG,IAAI,CAAA;AACnB,+BAAgB,GAAG,IAAI,CAAA;AAEvB,8BAAe,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE;IAC5C,cAAc,CAAC,YAAY,GAAG,QAAQ,CAAC;AACzC,CAAC,CAAC,CAAA;AACK,uCAAwB,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE;IACrD,cAAc,CAAC,qBAAqB,GAAG,QAAQ,CAAC;AAClD,CAAC,CAAC,CAAA;AACK,wCAAyB,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE;IACtD,cAAc,CAAC,sBAAsB,GAAG,QAAQ,CAAC;AACnD,CAAC,CAAC,CAAA;AACK,8BAAe,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE;IAC5C,cAAc,CAAC,YAAY,GAAG,QAAQ,CAAC;AACzC,CAAC,CAAC,CAAA;AACK,kCAAmB,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE;IAChD,cAAc,CAAC,gBAAgB,GAAG,QAAQ,CAAC;AAC7C,CAAC,CAAC,CAAA;AAEK,iCAAkB,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE;IACvC,cAAc,CAAC,qBAAqB,GAAG,IAAI,CAAC;AAC9C,CAAC,CAAC,CAAA;AAEK,kCAAmB,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE;IACxC,cAAc,CAAC,qBAAqB,GAAG,KAAK,CAAC;AAC/C,CAAC,CAAC,CAAA;AAEK,mCAAoB,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAA;AAClF,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG,cAAc,CAAC"}
|
@@ -0,0 +1,281 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const HTTPInterceptor_1 = require("../HTTPInterceptor");
|
16
|
+
const XHRInterceptor_1 = __importDefault(require("react-native/Libraries/Network/XHRInterceptor"));
|
17
|
+
const utils_1 = require("../utils");
|
18
|
+
jest.mock('buffer', () => ({
|
19
|
+
Blob: jest.fn(),
|
20
|
+
}));
|
21
|
+
jest.mock('../utils', () => ({
|
22
|
+
createClassWithErrorHandling: jest.fn(Class => Class),
|
23
|
+
formDataToString: jest.fn(),
|
24
|
+
}));
|
25
|
+
class MockFormData {
|
26
|
+
constructor() {
|
27
|
+
this.data = {};
|
28
|
+
}
|
29
|
+
append(key, value) {
|
30
|
+
this.data[key] = value;
|
31
|
+
}
|
32
|
+
get(key) {
|
33
|
+
return this.data[key];
|
34
|
+
}
|
35
|
+
}
|
36
|
+
class MockBlob {
|
37
|
+
constructor(parts, options = {}) {
|
38
|
+
this.content = parts ? parts.join('') : '';
|
39
|
+
this.type = options.type || '';
|
40
|
+
}
|
41
|
+
text() {
|
42
|
+
return Promise.resolve(this.content);
|
43
|
+
}
|
44
|
+
arrayBuffer() {
|
45
|
+
return Promise.resolve(new ArrayBuffer(0));
|
46
|
+
}
|
47
|
+
}
|
48
|
+
beforeAll(() => {
|
49
|
+
global.FormData = MockFormData;
|
50
|
+
});
|
51
|
+
afterAll(() => {
|
52
|
+
delete global.FormData;
|
53
|
+
});
|
54
|
+
describe('HTTPInterceptor', () => {
|
55
|
+
beforeEach(() => {
|
56
|
+
jest.clearAllMocks();
|
57
|
+
console.warn = jest.fn();
|
58
|
+
HTTPInterceptor_1.httpInterceptor.reset();
|
59
|
+
XHRInterceptor_1.default.isInterceptorEnabled.mockReturnValue(false);
|
60
|
+
});
|
61
|
+
describe('enable', () => {
|
62
|
+
it('should enable interception', () => {
|
63
|
+
HTTPInterceptor_1.httpInterceptor.enable();
|
64
|
+
expect(XHRInterceptor_1.default.enableInterception).toHaveBeenCalled();
|
65
|
+
});
|
66
|
+
it('should not enable if already enabled', () => {
|
67
|
+
HTTPInterceptor_1.httpInterceptor.enable();
|
68
|
+
HTTPInterceptor_1.httpInterceptor.enable();
|
69
|
+
expect(XHRInterceptor_1.default.enableInterception).toHaveBeenCalledTimes(1);
|
70
|
+
});
|
71
|
+
it('should handle ignored hosts', () => {
|
72
|
+
HTTPInterceptor_1.httpInterceptor.enable({ ignoredHosts: ['example.com'] });
|
73
|
+
expect(XHRInterceptor_1.default.enableInterception).toHaveBeenCalled();
|
74
|
+
});
|
75
|
+
it('should handle ignored patterns', () => {
|
76
|
+
HTTPInterceptor_1.httpInterceptor.enable({ ignoredPatterns: [/^GET https:\/\/test\.com/] });
|
77
|
+
expect(XHRInterceptor_1.default.enableInterception).toHaveBeenCalled();
|
78
|
+
});
|
79
|
+
it('should handle ignored URLs', () => {
|
80
|
+
HTTPInterceptor_1.httpInterceptor.enable({ ignoredUrls: ['https://example.com/api'] });
|
81
|
+
expect(XHRInterceptor_1.default.enableInterception).toHaveBeenCalled();
|
82
|
+
});
|
83
|
+
it('should warn if another interceptor is running', () => {
|
84
|
+
XHRInterceptor_1.default.isInterceptorEnabled.mockReturnValue(true);
|
85
|
+
console.warn = jest.fn();
|
86
|
+
HTTPInterceptor_1.httpInterceptor.enable();
|
87
|
+
expect(console.warn).toHaveBeenCalled();
|
88
|
+
});
|
89
|
+
it('should force enable if specified', () => {
|
90
|
+
XHRInterceptor_1.default.isInterceptorEnabled.mockReturnValue(true);
|
91
|
+
HTTPInterceptor_1.httpInterceptor.enable({ forceEnable: true });
|
92
|
+
expect(XHRInterceptor_1.default.enableInterception).toHaveBeenCalled();
|
93
|
+
});
|
94
|
+
});
|
95
|
+
describe('disable', () => {
|
96
|
+
it('should disable interception', () => {
|
97
|
+
HTTPInterceptor_1.httpInterceptor.enable();
|
98
|
+
HTTPInterceptor_1.httpInterceptor.disable();
|
99
|
+
expect(XHRInterceptor_1.default.disableInterception).toHaveBeenCalled();
|
100
|
+
});
|
101
|
+
it('should not disable if not enabled', () => {
|
102
|
+
HTTPInterceptor_1.httpInterceptor.disable();
|
103
|
+
expect(XHRInterceptor_1.default.disableInterception).not.toHaveBeenCalled();
|
104
|
+
});
|
105
|
+
});
|
106
|
+
describe('listeners', () => {
|
107
|
+
it('should add and remove listeners', () => {
|
108
|
+
const listener = jest.fn();
|
109
|
+
const removeListener = HTTPInterceptor_1.httpInterceptor.addListener('open', listener);
|
110
|
+
expect(HTTPInterceptor_1.httpInterceptor['userListeners'].length).toBe(1);
|
111
|
+
removeListener();
|
112
|
+
expect(HTTPInterceptor_1.httpInterceptor['userListeners'].length).toBe(0);
|
113
|
+
});
|
114
|
+
it('should not add duplicate listeners', () => {
|
115
|
+
const listener = jest.fn();
|
116
|
+
HTTPInterceptor_1.httpInterceptor.addListener('open', listener);
|
117
|
+
HTTPInterceptor_1.httpInterceptor.addListener('open', listener);
|
118
|
+
expect(HTTPInterceptor_1.httpInterceptor['userListeners'].length).toBe(1);
|
119
|
+
});
|
120
|
+
it('should remove specific listener', () => {
|
121
|
+
const listener1 = jest.fn();
|
122
|
+
const listener2 = jest.fn();
|
123
|
+
HTTPInterceptor_1.httpInterceptor.addListener('open', listener1);
|
124
|
+
HTTPInterceptor_1.httpInterceptor.addListener('open', listener2);
|
125
|
+
HTTPInterceptor_1.httpInterceptor.removeListener('open', listener1);
|
126
|
+
expect(HTTPInterceptor_1.httpInterceptor['userListeners'].length).toBe(1);
|
127
|
+
expect(HTTPInterceptor_1.httpInterceptor['userListeners'][0][1]).toBe(listener2);
|
128
|
+
});
|
129
|
+
it('should remove all listeners', () => {
|
130
|
+
HTTPInterceptor_1.httpInterceptor.addListener('open', jest.fn());
|
131
|
+
HTTPInterceptor_1.httpInterceptor.addListener('send', jest.fn());
|
132
|
+
HTTPInterceptor_1.httpInterceptor.removeAllListener();
|
133
|
+
expect(HTTPInterceptor_1.httpInterceptor['userListeners'].length).toBe(0);
|
134
|
+
});
|
135
|
+
});
|
136
|
+
describe('request handling', () => {
|
137
|
+
let openCallback;
|
138
|
+
let requestHeaderCallback;
|
139
|
+
let headerReceivedCallback;
|
140
|
+
let sendCallback;
|
141
|
+
let responseCallback;
|
142
|
+
beforeEach(() => {
|
143
|
+
HTTPInterceptor_1.httpInterceptor.enable();
|
144
|
+
openCallback = XHRInterceptor_1.default.setOpenCallback.mock.calls[0][0];
|
145
|
+
requestHeaderCallback = XHRInterceptor_1.default.setRequestHeaderCallback.mock.calls[0][0];
|
146
|
+
headerReceivedCallback = XHRInterceptor_1.default.setHeaderReceivedCallback.mock.calls[0][0];
|
147
|
+
sendCallback = XHRInterceptor_1.default.setSendCallback.mock.calls[0][0];
|
148
|
+
responseCallback = XHRInterceptor_1.default.setResponseCallback.mock.calls[0][0];
|
149
|
+
});
|
150
|
+
it('should handle open event', () => {
|
151
|
+
const listener = jest.fn();
|
152
|
+
HTTPInterceptor_1.httpInterceptor.addListener('open', listener);
|
153
|
+
const xhr = {};
|
154
|
+
openCallback('GET', 'https://example.com', xhr);
|
155
|
+
expect(listener).toHaveBeenCalledWith(expect.objectContaining({
|
156
|
+
method: 'GET',
|
157
|
+
url: 'https://example.com',
|
158
|
+
}));
|
159
|
+
});
|
160
|
+
it('should handle request header event', () => {
|
161
|
+
const listener = jest.fn();
|
162
|
+
HTTPInterceptor_1.httpInterceptor.addListener('requestHeader', listener);
|
163
|
+
const xhr = {};
|
164
|
+
openCallback('GET', 'https://example.com', xhr);
|
165
|
+
requestHeaderCallback('Content-Type', 'application/json', xhr);
|
166
|
+
expect(listener).toHaveBeenCalledWith(expect.objectContaining({
|
167
|
+
requestHeaders: { 'Content-Type': 'application/json' },
|
168
|
+
}));
|
169
|
+
});
|
170
|
+
it('should handle header received event', () => {
|
171
|
+
const listener = jest.fn();
|
172
|
+
HTTPInterceptor_1.httpInterceptor.addListener('headerReceived', listener);
|
173
|
+
const xhr = {};
|
174
|
+
openCallback('GET', 'https://example.com', xhr);
|
175
|
+
xhr.responseHeaders = { 'Content-Type': 'application/json' };
|
176
|
+
headerReceivedCallback('application/json', 100, {}, xhr);
|
177
|
+
expect(listener).toHaveBeenCalledWith(expect.objectContaining({
|
178
|
+
responseContentType: 'application/json',
|
179
|
+
responseSize: 100,
|
180
|
+
responseHeaders: { 'Content-Type': 'application/json' },
|
181
|
+
}));
|
182
|
+
});
|
183
|
+
it('should handle send event with JSON data', () => {
|
184
|
+
const listener = jest.fn();
|
185
|
+
HTTPInterceptor_1.httpInterceptor.addListener('send', listener);
|
186
|
+
const xhr = {};
|
187
|
+
openCallback('POST', 'https://example.com', xhr);
|
188
|
+
sendCallback(JSON.stringify({ key: 'value' }), xhr);
|
189
|
+
expect(listener).toHaveBeenCalledWith(expect.objectContaining({
|
190
|
+
requestData: { key: 'value' },
|
191
|
+
}));
|
192
|
+
});
|
193
|
+
it('should handle send event with FormData', () => {
|
194
|
+
const listener = jest.fn();
|
195
|
+
HTTPInterceptor_1.httpInterceptor.addListener('send', listener);
|
196
|
+
const xhr = {};
|
197
|
+
openCallback('POST', 'https://example.com', xhr);
|
198
|
+
const formData = new FormData();
|
199
|
+
formData.append('key', 'value');
|
200
|
+
utils_1.formDataToString.mockReturnValue('key=value');
|
201
|
+
sendCallback(formData, xhr);
|
202
|
+
expect(listener).toHaveBeenCalledWith(expect.objectContaining({
|
203
|
+
requestData: 'key=value',
|
204
|
+
}));
|
205
|
+
});
|
206
|
+
it('should handle response event', () => __awaiter(void 0, void 0, void 0, function* () {
|
207
|
+
const listener = jest.fn();
|
208
|
+
HTTPInterceptor_1.httpInterceptor.addListener('response', listener);
|
209
|
+
const xhr = {};
|
210
|
+
openCallback('GET', 'https://example.com', xhr);
|
211
|
+
yield responseCallback(200, 1000, { data: 'response' }, 'https://example.com', 'json', xhr);
|
212
|
+
expect(listener).toHaveBeenCalledWith(expect.objectContaining({
|
213
|
+
status: 200,
|
214
|
+
timeout: 1000,
|
215
|
+
responseData: { data: 'response' },
|
216
|
+
responseURL: 'https://example.com',
|
217
|
+
responseType: 'json',
|
218
|
+
}));
|
219
|
+
}));
|
220
|
+
it('should handle response event with blob data', () => __awaiter(void 0, void 0, void 0, function* () {
|
221
|
+
const listener = jest.fn();
|
222
|
+
HTTPInterceptor_1.httpInterceptor.addListener('response', listener);
|
223
|
+
const xhr = {};
|
224
|
+
openCallback('GET', 'https://example.com', xhr);
|
225
|
+
const mockBlob = new MockBlob(['blob content']);
|
226
|
+
yield responseCallback(200, 1000, mockBlob, 'https://example.com', 'blob', xhr);
|
227
|
+
expect(listener).toHaveBeenCalledWith(expect.objectContaining({
|
228
|
+
responseData: 'blob content',
|
229
|
+
}));
|
230
|
+
}));
|
231
|
+
});
|
232
|
+
describe('error handling', () => {
|
233
|
+
beforeEach(() => {
|
234
|
+
HTTPInterceptor_1.httpInterceptor.enable();
|
235
|
+
});
|
236
|
+
it('should handle errors in listeners', () => __awaiter(void 0, void 0, void 0, function* () {
|
237
|
+
const errorListener = jest.fn(() => {
|
238
|
+
throw new Error('Listener error');
|
239
|
+
});
|
240
|
+
HTTPInterceptor_1.httpInterceptor.addListener('open', errorListener);
|
241
|
+
console.warn = jest.fn();
|
242
|
+
const xhr = {};
|
243
|
+
const openCallback = XHRInterceptor_1.default.setOpenCallback.mock.calls[0][0];
|
244
|
+
openCallback('GET', 'https://example.com', xhr);
|
245
|
+
expect(console.warn).toHaveBeenCalledWith(expect.stringContaining('Listener error'));
|
246
|
+
}));
|
247
|
+
});
|
248
|
+
describe('ignored requests', () => {
|
249
|
+
it('should ignore requests to ignored hosts', () => {
|
250
|
+
HTTPInterceptor_1.httpInterceptor.enable({ ignoredHosts: ['ignored.com'] });
|
251
|
+
const openCallback = XHRInterceptor_1.default.setOpenCallback.mock.calls[0][0];
|
252
|
+
const listener = jest.fn();
|
253
|
+
HTTPInterceptor_1.httpInterceptor.addListener('open', listener);
|
254
|
+
openCallback('GET', 'https://ignored.com', { uniqueId: '123' });
|
255
|
+
expect(listener).not.toHaveBeenCalled();
|
256
|
+
openCallback('GET', 'https://example.com', { uniqueId: '124' });
|
257
|
+
expect(listener).toHaveBeenCalled();
|
258
|
+
});
|
259
|
+
it('should ignore requests to ignored URLs', () => {
|
260
|
+
HTTPInterceptor_1.httpInterceptor.enable({ ignoredUrls: ['https://example.com/ignored'] });
|
261
|
+
const openCallback = XHRInterceptor_1.default.setOpenCallback.mock.calls[0][0];
|
262
|
+
const listener = jest.fn();
|
263
|
+
HTTPInterceptor_1.httpInterceptor.addListener('open', listener);
|
264
|
+
openCallback('GET', 'https://example.com/ignored', { uniqueId: '123' });
|
265
|
+
expect(listener).not.toHaveBeenCalled();
|
266
|
+
openCallback('GET', 'https://example.com/api', { uniqueId: '124' });
|
267
|
+
expect(listener).toHaveBeenCalled();
|
268
|
+
});
|
269
|
+
it('should ignore requests matching ignored patterns', () => {
|
270
|
+
HTTPInterceptor_1.httpInterceptor.enable({ ignoredPatterns: [/^GET https:\/\/test\.com/] });
|
271
|
+
const openCallback = XHRInterceptor_1.default.setOpenCallback.mock.calls[0][0];
|
272
|
+
const listener = jest.fn();
|
273
|
+
HTTPInterceptor_1.httpInterceptor.addListener('open', listener);
|
274
|
+
openCallback('GET', 'https://test.com/api', { uniqueId: '123' });
|
275
|
+
expect(listener).not.toHaveBeenCalled();
|
276
|
+
openCallback('POST', 'https://test.com/api', { uniqueId: '124' });
|
277
|
+
expect(listener).toHaveBeenCalled();
|
278
|
+
});
|
279
|
+
});
|
280
|
+
});
|
281
|
+
//# sourceMappingURL=HTTPInterceptor.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"HTTPInterceptor.test.js","sourceRoot":"","sources":["../../../src/__tests__/HTTPInterceptor.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,wDAAqD;AACrD,mGAA2E;AAC3E,oCAA4C;AAG5C,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IACzB,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EAAE,6BAA6B,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;YACxE,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;YAExC,YAAY,CAAC,KAAK,EAAE,yBAAyB,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;YACpE,MAAM,CAAC,QAAQ,CAAC,CAAC,gBAAgB,EAAE,CAAC;QACtC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;YAC1D,iCAAe,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC;YAC1E,MAAM,YAAY,GAAI,wBAAc,CAAC,eAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACpF,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;YAC3B,iCAAe,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAE9C,YAAY,CAAC,KAAK,EAAE,sBAAsB,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;YACjE,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;YAExC,YAAY,CAAC,MAAM,EAAE,sBAAsB,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;YAClE,MAAM,CAAC,QAAQ,CAAC,CAAC,gBAAgB,EAAE,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,155 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const Server_1 = __importDefault(require("../Server"));
|
16
|
+
const utils_1 = require("../utils");
|
17
|
+
jest.mock('../utils', () => ({
|
18
|
+
hasPort: jest.fn(),
|
19
|
+
sleep: jest.fn().mockImplementation(() => new Promise(() => { })),
|
20
|
+
}));
|
21
|
+
jest.mock('../common', () => ({
|
22
|
+
tempFetch: jest.fn(),
|
23
|
+
}));
|
24
|
+
class MockResponse {
|
25
|
+
constructor(body) {
|
26
|
+
this.body = body;
|
27
|
+
}
|
28
|
+
text() {
|
29
|
+
return Promise.resolve(this.body);
|
30
|
+
}
|
31
|
+
static [Symbol.hasInstance](instance) {
|
32
|
+
return instance && typeof instance.text === 'function';
|
33
|
+
}
|
34
|
+
}
|
35
|
+
global.Response = MockResponse;
|
36
|
+
describe('Server', () => {
|
37
|
+
let server;
|
38
|
+
const mockUrl = 'http://example.com';
|
39
|
+
const mockTimeout = 5000;
|
40
|
+
beforeEach(() => {
|
41
|
+
server = new Server_1.default(mockUrl, mockTimeout);
|
42
|
+
jest.clearAllMocks();
|
43
|
+
});
|
44
|
+
describe('constructor', () => {
|
45
|
+
it('should initialize with correct url and timeout', () => {
|
46
|
+
expect(server['baseUrl']).toBe(mockUrl);
|
47
|
+
expect(server['timeout']).toBe(mockTimeout);
|
48
|
+
});
|
49
|
+
it('should use default timeout if not provided', () => {
|
50
|
+
const defaultServer = new Server_1.default(mockUrl);
|
51
|
+
expect(defaultServer['timeout']).toBe(3000);
|
52
|
+
});
|
53
|
+
});
|
54
|
+
describe('updateTimeout', () => {
|
55
|
+
it('should update the timeout', () => {
|
56
|
+
server.updateTimeout(10000);
|
57
|
+
expect(server['timeout']).toBe(10000);
|
58
|
+
});
|
59
|
+
it('should use default timeout if not provided', () => {
|
60
|
+
server.updateTimeout();
|
61
|
+
expect(server['timeout']).toBe(3000);
|
62
|
+
});
|
63
|
+
});
|
64
|
+
describe('getPort', () => {
|
65
|
+
it('should return empty string if url has port', () => {
|
66
|
+
utils_1.hasPort.mockReturnValue(true);
|
67
|
+
expect(server['getPort']()).toBe('');
|
68
|
+
});
|
69
|
+
it('should return default port if url has no port', () => {
|
70
|
+
utils_1.hasPort.mockReturnValue(false);
|
71
|
+
expect(server['getPort']()).toBe(27751);
|
72
|
+
});
|
73
|
+
});
|
74
|
+
describe('getUrl', () => {
|
75
|
+
it('should return correct url with port', () => {
|
76
|
+
utils_1.hasPort.mockReturnValue(false);
|
77
|
+
expect(server.getUrl()).toBe(`${mockUrl}:27751`);
|
78
|
+
});
|
79
|
+
it('should return correct url without port', () => {
|
80
|
+
utils_1.hasPort.mockReturnValue(true);
|
81
|
+
expect(server.getUrl()).toBe(`${mockUrl}:`);
|
82
|
+
});
|
83
|
+
});
|
84
|
+
describe('send', () => {
|
85
|
+
const mockPath = 'test';
|
86
|
+
const mockData = { key: 'value' };
|
87
|
+
const mockResponse = new MockResponse('success');
|
88
|
+
it('should return null if baseUrl is empty', () => __awaiter(void 0, void 0, void 0, function* () {
|
89
|
+
server.updateUrl('');
|
90
|
+
const result = yield server['send'](mockPath, mockData);
|
91
|
+
expect(result).toBeNull();
|
92
|
+
}));
|
93
|
+
it('should return response text on successful fetch', () => __awaiter(void 0, void 0, void 0, function* () {
|
94
|
+
const common = require('../common');
|
95
|
+
const mockResponseText = 'success';
|
96
|
+
const mockResponseObject = new MockResponse(mockResponseText);
|
97
|
+
common.tempFetch.mockResolvedValue(mockResponseObject);
|
98
|
+
const result = yield server['send'](mockPath, mockData);
|
99
|
+
expect(result).toBe(mockResponseText);
|
100
|
+
expect(common.tempFetch).toHaveBeenCalledWith(`${server.getUrl()}/${mockPath}`, expect.objectContaining({
|
101
|
+
method: 'POST',
|
102
|
+
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
103
|
+
body: JSON.stringify(mockData),
|
104
|
+
}));
|
105
|
+
}));
|
106
|
+
it('should return null on timeout', () => __awaiter(void 0, void 0, void 0, function* () {
|
107
|
+
const common = require('../common');
|
108
|
+
common.tempFetch.mockImplementation(() => new Promise(() => { }));
|
109
|
+
utils_1.sleep.mockResolvedValue(true);
|
110
|
+
const result = yield server['send'](mockPath, mockData);
|
111
|
+
expect(result).toBeNull();
|
112
|
+
}));
|
113
|
+
it('should handle Error objects in JSON stringification', () => __awaiter(void 0, void 0, void 0, function* () {
|
114
|
+
const common = require('../common');
|
115
|
+
common.tempFetch.mockResolvedValue(mockResponse);
|
116
|
+
const dataWithError = { error: new Error('Test error') };
|
117
|
+
yield server['send'](mockPath, dataWithError);
|
118
|
+
expect(common.tempFetch).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({
|
119
|
+
body: expect.stringContaining('Error: Test error'),
|
120
|
+
}));
|
121
|
+
}));
|
122
|
+
it('should return null on fetch error', () => __awaiter(void 0, void 0, void 0, function* () {
|
123
|
+
const common = require('../common');
|
124
|
+
common.tempFetch.mockRejectedValue(new Error('Fetch error'));
|
125
|
+
const result = yield server['send'](mockPath, mockData);
|
126
|
+
expect(result).toBeNull();
|
127
|
+
}));
|
128
|
+
});
|
129
|
+
describe('updateUrl', () => {
|
130
|
+
it('should update the baseUrl', () => {
|
131
|
+
const newUrl = 'http://newexample.com';
|
132
|
+
server.updateUrl(newUrl);
|
133
|
+
expect(server['baseUrl']).toBe(newUrl);
|
134
|
+
});
|
135
|
+
});
|
136
|
+
describe('log', () => {
|
137
|
+
it('should call send with correct path and data', () => __awaiter(void 0, void 0, void 0, function* () {
|
138
|
+
const sendSpy = jest.spyOn(server, 'send').mockResolvedValue('log result');
|
139
|
+
const logData = { message: 'Test log' };
|
140
|
+
const result = yield server.log(logData);
|
141
|
+
expect(sendSpy).toHaveBeenCalledWith('log', logData);
|
142
|
+
expect(result).toBe('log result');
|
143
|
+
}));
|
144
|
+
});
|
145
|
+
describe('network', () => {
|
146
|
+
it('should call send with correct path and data', () => __awaiter(void 0, void 0, void 0, function* () {
|
147
|
+
const sendSpy = jest.spyOn(server, 'send').mockResolvedValue('network result');
|
148
|
+
const networkData = { url: 'http://test.com', status: 200 };
|
149
|
+
const result = yield server.network(networkData);
|
150
|
+
expect(sendSpy).toHaveBeenCalledWith('network', networkData);
|
151
|
+
expect(result).toBe('network result');
|
152
|
+
}));
|
153
|
+
});
|
154
|
+
});
|
155
|
+
//# sourceMappingURL=Server.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Server.test.js","sourceRoot":"","sources":["../../../src/__tests__/Server.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uDAA+B;AAC/B,oCAA0C;AAG1C,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3B,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;IAClB,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;CACjE,CAAC,CAAC,CAAC;AAGJ,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5B,SAAS,EAAE,IAAI,CAAC,EAAE,EAAE;CACrB,CAAC,CAAC,CAAC;AAGJ,MAAM,YAAY;IAGhB,YAAY,IAAY;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,IAAI;QACF,OAAO,O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