Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): bump jest-when from 2.7.2 to 3.5.1 #294

Merged
merged 1 commit into from
Apr 26, 2022

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Feb 8, 2022

Bumps jest-when from 2.7.2 to 3.5.1.

Release notes

Sourced from jest-when's releases.

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 timkindberg/jest-when#89 562a35a

timkindberg/jest-when@v3.5.0...v3.5.1

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:

... (truncated)

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Feb 8, 2022
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/jest-when-3.5.1 branch 3 times, most recently from 5e8a94f to 959e47e Compare April 26, 2022 12:14
Bumps [jest-when](https://github.com/timkindberg/jest-when) from 2.7.2 to 3.5.1.
- [Release notes](https://github.com/timkindberg/jest-when/releases)
- [Commits](timkindberg/jest-when@v2.7.2...v3.5.1)

---
updated-dependencies:
- dependency-name: jest-when
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/jest-when-3.5.1 branch from 959e47e to 17e2a27 Compare April 26, 2022 12:15
@tomhjp tomhjp merged commit 25737ae into master Apr 26, 2022
@tomhjp tomhjp deleted the dependabot/npm_and_yarn/jest-when-3.5.1 branch April 26, 2022 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant