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): update dependency jest-when to v3.7.0 #496

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Oct 5, 2021

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
jest-when 3.4.0 -> 3.7.0 age adoption passing confidence
@types/jest-when (source) 2.7.3 -> 3.5.5 age adoption passing confidence

Release Notes

timkindberg/jest-when (jest-when)

v3.7.0

Compare Source

  • Support resetting of specific calledWith mocks ce60dd5 (closes #​108)

v3.6.0

Compare Source

v3.5.2

Compare Source

v3.5.1: Support @​golevelup/ts-jest and jest-mock-extended proxies

Compare Source

v3.5.0: Default Behavior Methods

Compare Source

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

Compare Source

  • Reset assertionCalls to zero so that our hack doesn't interfere with existing expect.assertions() usage 3a27d0b

v3.4.1

Compare Source

  • Access the equals util by grabbing it from the expect 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.

@renovate renovate bot force-pushed the renovate/jest-when-3.x branch from 2fce3dc to 9396cb5 Compare October 28, 2021 03:41
@renovate renovate bot changed the title chore(deps): update dependency jest-when to v3.4.1 chore(deps): update dependency jest-when to v3.4.2 Oct 28, 2021
@renovate renovate bot force-pushed the renovate/jest-when-3.x branch from 9396cb5 to def46cc Compare March 7, 2022 10:57
@renovate renovate bot changed the title chore(deps): update dependency jest-when to v3.4.2 chore(deps): update dependency jest-when to v3.5.1 Mar 7, 2022
@renovate renovate bot force-pushed the renovate/jest-when-3.x branch from def46cc to a288f6c Compare June 18, 2022 23:12
@renovate renovate bot force-pushed the renovate/jest-when-3.x branch from a288f6c to b857ab7 Compare August 24, 2022 18:06
@renovate renovate bot force-pushed the renovate/jest-when-3.x branch from b857ab7 to 510b9d7 Compare November 20, 2022 13:30
@renovate renovate bot changed the title chore(deps): update dependency jest-when to v3.5.1 chore(deps): update dependency jest-when to v3.5.2 Nov 20, 2022
@renovate renovate bot changed the title chore(deps): update dependency jest-when to v3.5.2 chore(deps): update dependency jest-when to v3.6.0 Aug 7, 2023
@renovate renovate bot force-pushed the renovate/jest-when-3.x branch from 510b9d7 to d160041 Compare August 7, 2023 16:52
@renovate renovate bot force-pushed the renovate/jest-when-3.x branch from d160041 to bd8c933 Compare September 15, 2023 22:09
@renovate renovate bot force-pushed the renovate/jest-when-3.x branch from bd8c933 to 9ca9044 Compare October 18, 2023 08:12
@renovate renovate bot force-pushed the renovate/jest-when-3.x branch from 9ca9044 to 840713f Compare November 7, 2023 11:10
@renovate renovate bot force-pushed the renovate/jest-when-3.x branch from 840713f to a64253e Compare December 3, 2024 18:20
@renovate renovate bot changed the title chore(deps): update dependency jest-when to v3.6.0 chore(deps): update dependency jest-when to v3.7.0 Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants