Skip to content

test: add remaining tests for other primitives#54

Merged
XiNiHa merged 1 commit into
mainfrom
tests
Mar 7, 2026
Merged

test: add remaining tests for other primitives#54
XiNiHa merged 1 commit into
mainfrom
tests

Conversation

@XiNiHa
Copy link
Copy Markdown
Owner

@XiNiHa XiNiHa commented Mar 7, 2026

Codex with GPT-5.4 did a pretty great job at writing these tests, requiring only minor adjustments to be made 😋

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 7, 2026

⚠️ No Changeset found

Latest commit: c2a7fba

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the test coverage for various solid-relay primitive hooks, including fragment handling, mutations, pagination, preloaded queries, query loading, refetchable fragments, and subscriptions. The additions ensure the robustness and correctness of these core functionalities, particularly under different data states and lifecycle events, and also include an initial SSR test for createFragment.

Highlights

  • Expanded Test Coverage: Comprehensive test suites were added for several solid-relay primitive hooks, including createFragment, createMutation, createPaginationFragment, createPreloadedQuery, createQueryLoader, createRefetchableFragment, and createSubscription.
  • GraphQL Schema Updates: The GraphQL schema was extended to support the new mutation and pagination test cases, introducing new query fields, mutations, and related types.
  • Server-Side Rendering (SSR) Test: An initial SSR test was introduced for the createFragment hook, ensuring proper server-side rendering and hydration behavior.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • tests/createFragment.test.tsx
    • Added new test file.
  • tests/createMutation.test.tsx
    • Added new test file.
  • tests/createPaginationFragment.test.tsx
    • Added new test file.
  • tests/createPreloadedQuery.test.tsx
    • Added new test file.
  • tests/createQueryLoader.test.tsx
    • Added new test file.
  • tests/createRefetchableFragment.test.tsx
    • Added new test file.
  • tests/createSubscription.test.tsx
    • Added new test file.
  • tests/schema.graphql
    • Updated the GraphQL schema by adding new query fields, mutations, and related types to support expanded testing.
  • tests/ssr/createFragment.test.ssr.tsx
    • Added new test file.
  • tests/ssr/setups/createFragment.tsx
    • Added new setup file.
  • tests/ssr/setups/index.ts
    • Updated the SSR setups index to include the new createFragment setup.
Activity
  • No specific activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
solid-relay c2a7fba Commit Preview URL

Branch Preview URL
Mar 07 2026, 06:00 PM

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 7, 2026

Open in StackBlitz

npm i https://pkg.pr.new/solid-relay@54

commit: 29f373b

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.37%. Comparing base (84ff641) to head (c2a7fba).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #54       +/-   ##
===========================================
+ Coverage   26.96%   90.37%   +63.41%     
===========================================
  Files          19       19               
  Lines         686      686               
  Branches      132      132               
===========================================
+ Hits          185      620      +435     
+ Misses        431       57      -374     
+ Partials       70        9       -61     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a comprehensive set of tests for various Solid Relay primitives, including createFragment, createMutation, createPaginationFragment, and others, along with corresponding SSR tests and schema updates. The overall quality of the tests is high. My review focuses on identifying opportunities to improve test coverage for key scenarios. I've suggested adding tests for fragment read errors and for verifying the UI impact of optimistic mutation updates. These additions would make the test suite even more robust.

expect(store?.()).toBeUndefined();
expect(store?.latest).toBeUndefined();
});
});
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.

medium

The test suite for createFragment is quite comprehensive. However, it's missing a test case for when reading the fragment from the store fails (e.g., due to data corruption or an inconsistent store state). This can happen in real applications and it's important to ensure the error is handled gracefully by the ErrorBoundary.

I suggest adding a test to cover this scenario. You can simulate this by manually manipulating a record in the mock store to be in an invalid state that observeFragment would fail to read.


await expect.element(page.getByTestId("pending")).toHaveTextContent("idle");
});
});
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.

medium

The tests for createMutation cover many important aspects. However, there isn't a test that verifies the UI effect of an optimisticResponse or an updater function. While the test 'becomes pending and forwards the mutation config' checks that these are passed to Relay, it doesn't assert that the optimistic update is actually rendered.

Testing the UI result of optimistic updates is crucial for mutations. I recommend adding a test case that renders data, performs a mutation with an optimistic response, and asserts that the UI updates immediately before the network request completes.

@XiNiHa XiNiHa merged commit c2cd99f into main Mar 7, 2026
5 checks passed
@XiNiHa XiNiHa deleted the tests branch March 7, 2026 18:06
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.

1 participant