Skip to content

Commit 0b926b9

Browse files
Remove a layer of indirection for defaultRejectedValue
Came across this while evaluating the library -- it looks like it was inadvertently doing `Promise.resolve(Promise.reject(err))`. That's mostly equivalent enough to `Promise.reject(err)`, but we might as well just do the simple thing.
1 parent 3ea3f71 commit 0b926b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/when.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class WhenMock {
154154
}
155155
this.defaultReturnValue = returnValue => this.defaultImplementation(() => returnValue)
156156
this.defaultResolvedValue = returnValue => this.defaultReturnValue(Promise.resolve(returnValue))
157-
this.defaultRejectedValue = err => this.defaultResolvedValue(Promise.reject(err))
157+
this.defaultRejectedValue = err => this.defaultReturnValue(Promise.reject(err))
158158
this.mockImplementation = this.defaultImplementation
159159
this.mockReturnValue = this.defaultReturnValue
160160
this.mockResolvedValue = this.defaultResolvedValue

0 commit comments

Comments
 (0)