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

fix: Union test mock generator #2298

Merged
merged 7 commits into from
Jun 7, 2022
Merged

Conversation

calvincestari
Copy link
Member

@calvincestari calvincestari commented Jun 7, 2022

This PR:

  1. Adds a target dependency to the ApolloTestSupport package.
  2. Adds the generation of test mock extensions for Union types that conform to MockFieldValue.

Alternatives solutions for Union conforming to MockFieldValue

  • Change the Union protocol declaration to add conformance to MockFieldValue; the extension then to implement the typealias can be in that file or elsewhere. The problem with this approach is that MockFieldValue references AnyMock and attempting to import ApolloTestSupport creates a circular dependency. Bringing the AnyMock declaration into ApolloAPI resolves build errors in Union.swift but makes Union unusable in ParentType because of the associated type requirement - Protocol 'Union' can only be used as a generic constraint because it has Self or associated type requirements.

@calvincestari calvincestari requested a review from AnthonyMDev June 7, 2022 06:39
@calvincestari
Copy link
Member Author

@AnthonyMDev let's discuss this again in the morning but I think generating the union test mock extensions may be the best solution.

@AnthonyMDev
Copy link
Contributor

Looks like you've got a test that needs updating, but otherwise I'm good to ship this!

Base automatically changed from 1.0/alpha-6 to release/1.0 June 7, 2022 17:03
@netlify
Copy link

netlify bot commented Jun 7, 2022

Deploy Preview for apollo-ios-docs ready!

Name Link
🔨 Latest commit 71633cb
🔍 Latest deploy log https://app.netlify.com/sites/apollo-ios-docs/deploys/629f87492640470008d56b9e
😎 Deploy Preview https://deploy-preview-2298--apollo-ios-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@calvincestari calvincestari marked this pull request as ready for review June 7, 2022 17:19
@calvincestari calvincestari merged commit 11bc60d into release/1.0 Jun 7, 2022
@calvincestari calvincestari deleted the 1.0/fix-union-test-mocks branch June 7, 2022 17:20
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.

2 participants