Skip to content

Commit 2962eb8

Browse files
committed
add jsonRPCProcessor test
1 parent f2ab6c3 commit 2962eb8

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/test/testing/testController/server.unit.test.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,20 @@ suite('Python Test Server', () => {
156156
assert.deepStrictEqual(eventData, '');
157157
});
158158
test('jsonRPCProcessor', async () => {
159-
const rawDataString = '';
159+
const rawDataString = `Content-Length: 160
160+
Content-Type: application/json
161+
Request-uuid: xxxxxx-1012-xxxx-xxxx-xxx
162+
163+
{"cwd": "/path/to/folder", "status": "success", "tests": {"name": "test", "path": "/path/to/test", "type_": "folder", "children": []}], "id_": "/path/to/test"}}`;
164+
const headers = new Map<string, string>([
165+
['Content-Length', '160'],
166+
['Content-Type', 'application/json'],
167+
['Request-uuid', 'xxxxxx-1012-xxxx-xxxx-xxx'],
168+
]);
160169
const expected: IJSONRPCMessage = {
161-
headers: new Map<string, string>(),
162-
extractedData: 'string',
163-
remainingRawData: 'string',
170+
headers,
171+
extractedData: `{"cwd": "/path/to/folder", "status": "success", "tests": {"name": "test", "path": "/path/to/test", "type_": "folder", "children": []}], "id_": "/path/to/test"}}`,
172+
remainingRawData: '',
164173
};
165174
const output: IJSONRPCMessage = jsonRPCProcessor(rawDataString);
166175
assert.deepStrictEqual(output, expected);

0 commit comments

Comments
 (0)