Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/app/app-client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -822,10 +822,13 @@ describe('AppClient tests', () => {
nextPageToken: 'nextPage',
});

let capturedRequest: pb.GetRobotPartLogsRequest | undefined;

beforeEach(() => {
mockTransport = createRouterTransport(({ service }) => {
service(AppService, {
getRobotPartLogs: () => {
getRobotPartLogs: (req) => {
capturedRequest = req;
return expectedResponse;
},
});
Expand All @@ -835,6 +838,17 @@ describe('AppClient tests', () => {
it('getRobotPartLogs', async () => {
const response = await subject().getRobotPartLogs('email');
expect(response).toEqual(expectedResponse);
expect(capturedRequest?.id).toEqual('email');
expect(capturedRequest?.filter).toBeUndefined();
expect(capturedRequest?.levels).toEqual([]);
expect(capturedRequest?.pageToken).toEqual('');
expect(capturedRequest?.userFacingOnly).toBeUndefined();
});

it('getRobotPartLogs with userFacingOnly', async () => {
await subject().getRobotPartLogs('robotId', undefined, undefined, '', true);
expect(capturedRequest?.id).toEqual('robotId');
expect(capturedRequest?.userFacingOnly).toEqual(true);
});
});

Expand Down Expand Up @@ -2112,4 +2126,4 @@ describe('AppClient tests', () => {
expect(response.fragmentIds).toEqual(['frag1', 'frag2']);
});
});
});
});
5 changes: 4 additions & 1 deletion src/app/app-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -899,20 +899,23 @@ export class AppClient {
* all log levels
* @param pageToken Optional string indicating which page of logs to query.
* Defaults to the most recent
* @param userFacingOnly Optional boolean to indicate whether or not only user-facing logs should be returned. Defaults to false
* @returns The robot requested logs and the page token for the next page of
* logs
*/
async getRobotPartLogs(
id: string,
filter?: string,
levels?: string[],
pageToken = ''
pageToken = '',
userFacingOnly?: boolean
): Promise<GetRobotPartLogsResponse> {
return this.client.getRobotPartLogs({
id,
filter,
levels,
pageToken,
userFacingOnly,
});
}

Expand Down
Loading