Skip to content

test(uiStore): achieve 100% store coverage by covering setTestModalVisible#15

Closed
hh54188 wants to merge 1 commit intomasterfrom
coverage-improvement-20251001-163321
Closed

test(uiStore): achieve 100% store coverage by covering setTestModalVisible#15
hh54188 wants to merge 1 commit intomasterfrom
coverage-improvement-20251001-163321

Conversation

@hh54188
Copy link
Owner

@hh54188 hh54188 commented Oct 1, 2025

Summary

  • Add tests for setTestModalVisible in uiStore
  • Verify testModalVisible resets in resetUIState
  • Confirm 100% line/function/branch coverage for store files via npm run test:stores:coverage

Test plan

  • Run npm run test:stores:coverage
  • Verify coverage report shows 100% for src/stores/uiStore.js and src/stores/chatStore.js

Notes

  • Based on uncovered analysis in chrome-extension/uncovered-analysis.json

…store coverage

Add tests to toggle `testModalVisible` and verify it resets in `resetUIState`.
Achieves 100% line/function/branch coverage for `src/stores/uiStore.js` per uncovered analysis.

Refs: uncovered-analysis.json
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hh54188, 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 focuses on enhancing the test suite for the UI store by introducing new tests for the setTestModalVisible function and verifying its interaction with the resetUIState mechanism. The primary objective is to ensure robust functionality and maintain 100% code coverage for the store files, thereby improving the overall reliability and maintainability of the UI state management.

Highlights

  • New Test Cases: Added comprehensive test cases for the setTestModalVisible function within the uiStore, ensuring its correct behavior for both showing and hiding the test modal.
  • State Reset Verification: Verified that the testModalVisible state is correctly reset to false when the resetUIState function is invoked, improving the reliability of UI state management.
  • 100% Store Coverage: Achieved 100% line, function, and branch coverage for the uiStore.js and chatStore.js store files, as confirmed by the npm run test:stores:coverage report.
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.

Copy link
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 successfully adds test coverage for the setTestModalVisible action in uiStore, achieving 100% coverage as intended. The changes include new tests for setting the modal's visibility and verifying that its state is correctly reset by resetUIState. The implementation is correct and follows existing patterns. I have one suggestion to refactor the new tests to be more concise and reduce duplication, which could improve maintainability.

Comment on lines +211 to +226
describe('setTestModalVisible', () => {
it('should show test modal', () => {
const { setTestModalVisible } = useUIStore.getState();
setTestModalVisible(true);
const state = useUIStore.getState();
expect(state.testModalVisible).toBe(true);
});

it('should hide test modal', () => {
const { setTestModalVisible } = useUIStore.getState();
setTestModalVisible(true);
setTestModalVisible(false);
const state = useUIStore.getState();
expect(state.testModalVisible).toBe(false);
});
});
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The two separate tests for showing and hiding the modal are correct. However, they can be consolidated into a single test case to reduce duplication and improve clarity by testing the full true/false cycle in one place.

    describe('setTestModalVisible', () => {
      it('should set test modal visibility correctly', () => {
        const { setTestModalVisible } = useUIStore.getState();

        // Set to true and verify
        setTestModalVisible(true);
        expect(useUIStore.getState().testModalVisible).toBe(true);

        // Set to false and verify
        setTestModalVisible(false);
        expect(useUIStore.getState().testModalVisible).toBe(false);
      });
    });

@hh54188 hh54188 closed this Oct 1, 2025
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