Skip to content

Commit

Permalink
feat(test): improve error reporting in MockHTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Feb 13, 2019
1 parent 0325e42 commit 3027d8d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/rest/MockHTTP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ import { StreamResponse } from '../../src/model/StreamResponse';

const getError = (method: string, urlObj: any, options?: TwitarrHTTPOptions) => {
// tslint:disable-next-line
return new Error('Not yet implemented: ' + method + ' ' + urlObj.toString() + ': ' + JSON.stringify(options.parameters) + ' ' + JSON.stringify(options.data));
let message = 'Net yet implemented: ' + method + ' ' + urlObj.toString();
if (options) {
message += ': ';
if (options.parameters) {
message += 'parameters=' + JSON.stringify(options.parameters);
}
if (options.data) {
message += 'data=' + JSON.stringify(options.data);
}
}
return new Error(message);
};

const jsonOK = (contents: any) => {
Expand Down

0 comments on commit 3027d8d

Please sign in to comment.