Skip to content

Commit

Permalink
feat: add title with request's method and path on logDiffOn501
Browse files Browse the repository at this point in the history
  • Loading branch information
ybonnefond committed Nov 18, 2020
1 parent 0d779a0 commit eba1ebe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/debug/Debugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export class Debugger {
public logDiff(route: Route) {
const out = new Output();

out.add(`## Request: ${this.request.method} ${this.request.path}`);

out.renderErrors(
'Method',
methodDiff(route.getMethod(), this.request.method),
Expand Down
8 changes: 6 additions & 2 deletions test/specs/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`index debug should output object 1`] = `
"Method
"## Request: GET /test-stuff
Method
- Received: get
+ Expected: post
Expand All @@ -18,7 +20,9 @@ Body
`;

exports[`index debug should output various stuff 1`] = `
"Method
"## Request: POST /test
Method
- Received: post
+ Expected: put
Expand Down
10 changes: 8 additions & 2 deletions test/specs/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,10 @@ describe('index', () => {
const out = await run(req);

expect(out).toEqual(
'Method\n' + '- Received: post\n' + '+ Expected: put',
'## Request: POST /\n\n' +
'Method\n' +
'- Received: post\n' +
'+ Expected: put',
);
});

Expand Down Expand Up @@ -849,7 +852,10 @@ describe('index', () => {
const out = await run(req);

expect(out).toEqual(
'Method\n' + '- Received: post\n' + '+ Expected: put',
'## Request: POST /\n\n' +
'Method\n' +
'- Received: post\n' +
'+ Expected: put',
);
});
});
Expand Down

0 comments on commit eba1ebe

Please sign in to comment.