Skip to content

test: remaining createLazyLoadQuery tests for 100% coverage#51

Merged
XiNiHa merged 1 commit into
mainfrom
lazyloadquery-100
Mar 5, 2026
Merged

test: remaining createLazyLoadQuery tests for 100% coverage#51
XiNiHa merged 1 commit into
mainfrom
lazyloadquery-100

Conversation

@XiNiHa
Copy link
Copy Markdown
Owner

@XiNiHa XiNiHa commented Mar 5, 2026

No description provided.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 5, 2026

⚠️ No Changeset found

Latest commit: 6246ea3

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 primarily focuses on improving the robustness and test coverage of the createLazyLoadQuery hook within the Solid-Relay library. It includes a minor refactoring of the createDataStore utility to standardize resource access, which in turn required a small adjustment in createFragmentInternal. The bulk of the changes involve adding comprehensive new tests to cover various scenarios and edge cases for createLazyLoadQuery, ensuring its reliability and correctness across different usage patterns and fetch policies.

Highlights

  • Refactored Data Store Resource Handling: The createDataStore utility now explicitly accepts an Accessor<Resource<unknown> | undefined> instead of a MaybeAccessor, ensuring that the resource is always accessed via a function call. This change improves consistency and reactivity in how resources are handled within data stores.
  • Updated Fragment Creation Logic: The createFragmentInternal function was updated to align with the new createDataStore signature, passing the resource as an accessor (() => resource) to maintain compatibility and correct behavior.
  • Enhanced createLazyLoadQuery Test Coverage: Several new test cases were added for createLazyLoadQuery to achieve 100% coverage. These tests validate data store getters (e.g., pending, error, latest), ensure fetching occurs with specific fetch policies (store-and-network, network-only) even when data is present, handle edge cases like undefined variables, demonstrate cache reuse for concurrent consumers, and confirm proper cleanup and default behavior for live queries.

🧠 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
  • src/primitives/createFragment.ts
    • Updated the call to createDataStore to pass the resource as an accessor function.
  • src/utils/dataStore.ts
    • Modified the createDataStore function signature to accept resourceAccessor: Accessor<Resource<unknown> | undefined>.
    • Removed the MaybeAccessor type import.
    • Added the Accessor type import.
    • Removed the extractResource helper function.
    • Updated internal logic to directly call resourceAccessor() instead of using the removed extractResource.
  • tests/createLazyLoadQuery.test.tsx
    • Added a test case to verify the functionality of DataStore getters (pending, error, latest).
    • Introduced tests for fetchPolicy: store-and-network and network-only to confirm data fetching even when data already exists.
    • Added a test to ensure no fetch occurs when the variables accessor returns undefined.
    • Implemented a test to validate cache reuse for concurrent consumers and subsequent refetching after all consumers dispose.
    • Included a test to confirm live queries default to store-and-network fetch policy and clean up correctly on unmount.
    • Imported createSignal and DataStore type for new test cases.
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.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 5, 2026

Open in StackBlitz

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

commit: 440794f

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 5, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 26.83%. Comparing base (ecc368d) to head (6246ea3).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/primitives/createFragment.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #51      +/-   ##
==========================================
+ Coverage   26.16%   26.83%   +0.66%     
==========================================
  Files          19       19              
  Lines         684      682       -2     
  Branches      133      132       -1     
==========================================
+ Hits          179      183       +4     
+ Misses        435      429       -6     
  Partials       70       70              

☔ 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 enhances test coverage for createLazyLoadQuery to 100% by adding several new tests for edge cases and different fetch policies. The new tests cover scenarios like data store getter exposure, behavior with store-and-network and network-only policies, handling of undefined variables, cache reuse for concurrent consumers, and live query defaults. Additionally, a minor refactoring in createDataStore simplifies its API by consistently requiring an accessor for the resource, which is a good improvement for code clarity and predictability. The changes are well-implemented and the new tests are comprehensive.

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

cloudflare-workers-and-pages Bot commented Mar 5, 2026

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 6246ea3 Commit Preview URL

Branch Preview URL
Mar 05 2026, 08:35 PM

@XiNiHa XiNiHa force-pushed the lazyloadquery-100 branch from 389a11a to 6246ea3 Compare March 5, 2026 20:32
@XiNiHa XiNiHa merged commit 0c65018 into main Mar 5, 2026
5 checks passed
@XiNiHa XiNiHa deleted the lazyloadquery-100 branch March 5, 2026 20:36
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