eigen icon indicating copy to clipboard operation
eigen copied to clipboard

refactor(tests): running automatic step to convert tests to new form, manual steps to come

Open pvinis opened this issue 3 years ago • 0 comments

This PR resolves []

Description

Automated/Find-and-Replace

  • [x] remove all jest.unmock("react-relay")
  • [x] replace every defaultEnvironment with getRelayEnvironment()
  • [ ] replace every mockEnvironment.mock with getMockRelayEnvironment().mock
  • [x] remove all code like let mockEnvironment: ReturnType<typeof createMockEnvironment>
  • [x] remove all code blocks like:
beforeEach(() => {
  mockEnvironment = createMockEnvironment()
})
  • [x] replace all code blocks like (to remove the env arg):
resolveMostRecentRelayOperation(mockEnvironment, {
  FilterArtworksConnection: () => ({
    counts: {
      followedArtists: 0,
      total: 0,
    },
    edges: [],
  }),
})

with

resolveMostRecentRelayOperation( {
  FilterArtworksConnection: () => ({
    counts: {
      followedArtists: 0,
      total: 0,
    },
    edges: [],
  }),
})
  • [ ] replace all code blocks like:
env.mock.resolveMostRecentOperation((operation) =>
  MockPayloadGenerator.generate(operation, {
    Me: () => ({
      name: "wow",
    }),
  })
)

with

resolveMostRecentRelayOperation({
  Me: () => ({
    name: "wow",
  }),
})
  • [x] replace renderWithHookWrappersTL with renderWithRelayWrappers

Manual

  • if possible, change the tests to the new suggested way in EXAMPLES.md, using async, render, resolve, await wait, expects.

  • if you have issues with making the tests run, check the current main branch, in case some of the above actions failed

QA Test Case(s)

Test Case Feature Environment Acceptance Criteria Setup Instructions/Link

PR Checklist

  • [ ] I tested my changes on iOS / Android.
  • [ ] I added screenshots or videos to illustrate my changes.
  • [ ] I added Tests and Stories for my changes.
  • [ ] I added an app state migration.
  • [ ] I hid my changes behind a feature flag.

To the reviewers 👀

  • [ ] I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Cross-platform user-facing changes

iOS user-facing changes

Android user-facing changes

Dev changes

Need help with something? Have a look at our docs, or get in touch with us.

pvinis avatar Jul 22 '22 11:07 pvinis