Skip to content

Commit

Permalink
fixup: more typos and tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mcous committed May 8, 2024
1 parent 881e864 commit b8c4b52
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ debug(coolFunc)
// `coolFunc()` has:
//
// 2 stubbings with 0 calls
// - 0 calls: `coolFunc(4, 5, 6) => { throw [Error: oh no] }`
// - 0 calls: `coolFunc(1, 2, 3) => 123`
// - 0 calls: `coolFunc(4, 5, 6) => { throw [Error: oh no] }`
//
// 1 unmatched call
// - `coolFunc(1, 2, 4)`
Expand Down
4 changes: 3 additions & 1 deletion src/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export const formatDebug = (debug: DebugResult): string => {
'stubbing',
stubbingCount,
)} with ${callCount} calls`,
...stubbings.map((stubbing) => `- ${formatStubbing(name, stubbing)}`),
...stubbings
.map((stubbing) => `- ${formatStubbing(name, stubbing)}`)
.reverse(),
'',
`${unmatchedCallsCount} unmatched ${plural('call', unmatchedCallsCount)}`,
...unmatchedCalls.map((args) => `- \`${formatCall(name, args)}\``),
Expand Down
11 changes: 0 additions & 11 deletions test/vitest-when.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,4 @@ describe('vitest-when', () => {
unmatchedCalls: [],
})
})

it('logs debug description', () => {
const coolFunction = vi.fn().mockName('coolFunc')

subject.when(coolFunction).calledWith(1, 2, 3).thenReturn(123)
subject.when(coolFunction).calledWith(4, 5, 6).thenThrow(new Error('oh no'))

coolFunction(1, 2, 4)

subject.debug(coolFunction)
})
})

0 comments on commit b8c4b52

Please sign in to comment.