Skip to content

Remove deprecated addTypename usage from Donate Apollo tests - #637

Merged
conorheffron merged 2 commits into
mainfrom
copilot/fix-remove-add-typename-prop
Apr 12, 2026
Merged

Remove deprecated addTypename usage from Donate Apollo tests#637
conorheffron merged 2 commits into
mainfrom
copilot/fix-remove-add-typename-prop

Conversation

Copilot AI commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Node.js CI was failing in frontend because Apollo Client v3.14.1 rejects MockedProvider’s deprecated addTypename prop in Donate.test.js, triggering render-time test failures. This PR updates the test suite to align with current Apollo testing behavior.

  • Scope

    • Updated frontend/src/components/__tests__/Donate.test.js only.
  • Apollo test compatibility fix

    • Removed addTypename={true} from all MockedProvider instances in the Donate component tests.
    • Kept existing mocks intact (they already include __typename), so behavior and assertions remain unchanged.
  • Impact

    • Eliminates Apollo deprecation/error path that was breaking the Donate test renders in CI.
- <MockedProvider mocks={mocks} addTypename={true}>
+ <MockedProvider mocks={mocks}>
    <Donate />
  </MockedProvider>
Original prompt

Create a fix for the failing GitHub Actions job in conorheffron/ironoc.

Context:

  • The workflow is .github/workflows/node.js.yml and runs tests in ./frontend.
  • The failing test suite is due to Apollo MockedProvider throwing/warning that the addTypename prop should be removed (Apollo Client v3.14.1).
  • Job log shows failures at frontend/src/components/__tests__/Donate.test.js:59:15 and :70:15 during render(...).

Required changes:

  1. Update frontend/src/components/__tests__/Donate.test.js to remove the deprecated/unsupported addTypename prop from all MockedProvider usages.
  2. Ensure tests pass (npm run test:coverage in frontend).

Relevant file:

  • frontend/src/components/__tests__/Donate.test.js

Acceptance criteria:

  • GitHub Actions Node.js CI passes.
  • All tests pass locally in CI (npm run test:coverage).

Please open a pull request against main with these changes.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: The job is failing because the test suite crashes while rendering MockedProvider in frontend/src/components/__tests__/Donate.test.js.

Root cause

Your logs show an Apollo warning/error:

MockedProvider addTypename — “Please remove the addTypename prop …”

In Apollo Client @apollo/client/testing (v3.14.1 per the log), MockedProvider no longer accepts addTypename. In your test file you pass it in three places (lines 60, 71, 84), which causes the render to fail and the suite to exit non‑zero.

Fix (update the failing test)

Edit frontend/src/components/__tests__/Donate.test.js and remove the addTypename prop everywhere.

- <MockedProvider mocks={mocks} addTypename={true}>
+ <MockedProvider mocks={mocks}>
    <Donate />
  </MockedProvider>

Apply the same change to the other two renders:

- <MockedProvider mocks={errorMocks} addTypename={true}>
+ <MockedProvider mocks={errorMocks}>
    <Donate />
  </MockedProvider>

- <MockedProvider mocks={mocks} addTypename={true}>
+ <MockedProvider mocks={mocks}>
    <Donate />
  </MockedProvider>

That should stop the render(...) crash at src/components/__tests__/Donate.test.js:70:15 (and the earlier one at :59:15) and allow Jest to complete.

Notes (not required to pass, but worth cleaning up)

The logs also include console errors like unrecognized tags (<h7>, <h8>, <h11>) and invalid DOM nesting (<a> inside <a>). These are warnings and didn’t fail this run, but they can become failures if you add stricter Jest settings (e.g., failing on console.error).

User: Please create pull request with fix copilot

Assistant: I’ve submitted the pull request to fix the failing CI by removing the deprecated addTypename prop from MockedProvider usages in frontend/src/components/__tests__/Donate.test.js; please review and merge it from your repo’s Pull Requests tab.

This pull request was created from Copilot chat.

@github-actions
github-actions Bot requested a review from conorheffron April 12, 2026 22:43
@conorheffron conorheffron added bug Something isn't working tests unit | integration tests labels Apr 12, 2026
@conorheffron
conorheffron marked this pull request as ready for review April 12, 2026 22:43
@conorheffron
conorheffron requested a review from Copilot April 12, 2026 22:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@conorheffron conorheffron added ui-frontend javascript Pull requests that update Javascript code labels Apr 12, 2026
Copilot AI changed the title [WIP] Fix tests by removing addTypename prop from MockedProvider Remove deprecated addTypename usage from Donate Apollo tests Apr 12, 2026
Copilot AI requested a review from conorheffron April 12, 2026 22:47
@conorheffron
conorheffron merged commit a21b937 into main Apr 12, 2026
10 of 11 checks passed
@conorheffron
conorheffron deleted the copilot/fix-remove-add-typename-prop branch April 12, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working javascript Pull requests that update Javascript code tests unit | integration tests ui-frontend

Projects

Development

Successfully merging this pull request may close these issues.

3 participants