nestjs-multer-extended
nestjs-multer-extended copied to clipboard
chore(deps): update dependency jest-when to v3.6.0
This PR contains the following updates:
Package | Change | Age | Adoption | Passing | Confidence |
---|---|---|---|---|---|
jest-when | 3.4.0 -> 3.6.0 |
||||
@types/jest-when (source) | 2.7.3 -> 3.5.5 |
Release Notes
timkindberg/jest-when (jest-when)
v3.6.0
v3.5.2
v3.5.1
: Support @βgolevelup/ts-jest and jest-mock-extended proxies
- v3.5.1
781bfce
- Add .tool-versions for asdf
77cd461
- Merge pull request #β93 from mjgp2/issue-89
97b3725
- fixes #β89
562a35a
v3.5.0
: Default Behavior Methods
New methods:
-
defaultReturnValue
-
defaultResolvedValue
-
defaultRejectedValue
-
defaultImplementation
Use them to set up a default behavior, which will serve as fallback if no matcher fits.
when(fn)
.calledWith('foo').mockReturnValue('special')
.defaultReturnValue('default') // This line can be placed anywhere, doesn't have to be at the end
expect(fn('foo')).toEqual('special')
expect(fn('bar')).toEqual('default')
Previously you needed to use any of mockReturnValue
, mockResolvedValue
, mockRejectedValue
, or mockImplementation
directly on the object before using calledWith to create a default fallback.
// Same as above example
when(fn)
.mockReturnValue('default')
.calledWith('foo').mockReturnValue('special')
One neat idea, and the reason I even did this work, is to set up a default implementation that throws an error if an improper call is made to the mock.
when(fn)
.calledWith(correctArgs)
.mockReturnValue(expectedValue)
.defaultImplementation(unsupportedCallError)
// A default implementation that fails your test
function unsupportedCallError(...args) {
throw new Error(`Wrong args: ${JSON.stringify(args, null, 2)}`);
}
Commits:
- Merge pull request #β92 from timkindberg/default_methods
67b7532
- Add several methods to set up default behaviors. These methods can be placed anywhere in the mocking set up, including after other calledWith setups, unlike previous "default" behavior using
when(fn).mockReturnValue(z)
. You can now do:when(fn).calledWith(x).mockReturnValue(y).defaultReturnValue(z)
.77fe672
- Add documentation example for unsupported call error as default implementation
a6dc74d
v3.4.2
- Reset assertionCalls to zero so that our hack doesn't interfere with existing expect.assertions() usage
3a27d0b
v3.4.1
- Access the
equals
util by grabbing it from theexpect
this arg. Temporary hack until core jest exposes this util officially.5a8cc93
See https://github.com/facebook/jest/issues/11867#issuecomment-934523457
Configuration
π Schedule: Branch creation - "every weekday" (UTC), Automerge - At any time (no schedule defined).
π¦ Automerge: Enabled.
β» Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
π Ignore: Close this PR and you won't be reminded about these updates again.
- [ ] If you want to rebase/retry this PR, check this box
This PR was generated by Mend Renovate. View the repository job log.