Skip to content

Commit

Permalink
add jsonRPCProcessor test
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorjboyd committed Apr 6, 2023
1 parent f2ab6c3 commit 2962eb8
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/test/testing/testController/server.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,20 @@ suite('Python Test Server', () => {
assert.deepStrictEqual(eventData, '');
});
test('jsonRPCProcessor', async () => {
const rawDataString = '';
const rawDataString = `Content-Length: 160
Content-Type: application/json
Request-uuid: xxxxxx-1012-xxxx-xxxx-xxx
{"cwd": "/path/to/folder", "status": "success", "tests": {"name": "test", "path": "/path/to/test", "type_": "folder", "children": []}], "id_": "/path/to/test"}}`;
const headers = new Map<string, string>([
['Content-Length', '160'],
['Content-Type', 'application/json'],
['Request-uuid', 'xxxxxx-1012-xxxx-xxxx-xxx'],
]);
const expected: IJSONRPCMessage = {
headers: new Map<string, string>(),
extractedData: 'string',
remainingRawData: 'string',
headers,
extractedData: `{"cwd": "/path/to/folder", "status": "success", "tests": {"name": "test", "path": "/path/to/test", "type_": "folder", "children": []}], "id_": "/path/to/test"}}`,
remainingRawData: '',
};
const output: IJSONRPCMessage = jsonRPCProcessor(rawDataString);
assert.deepStrictEqual(output, expected);
Expand Down

0 comments on commit 2962eb8

Please sign in to comment.