Skip to content

fix: add missing modText and isMacOrIOS mocks to fix CI test failures #40389

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

Merged

Conversation

jacquesikot
Copy link
Contributor

@jacquesikot jacquesikot commented Apr 25, 2025

Description

This PR fixes the CI test failures in useTableOrSpreadsheet.test.ts by adding proper mocks for the modText and isMacOrIOS functions from the helpers module. While tests passed locally, they were failing in CI due to these missing mocks.
Changes made:

  • Added mock implementations for modText and isMacOrIOS functions
  • Reorganized imports for better readability
  • Maintained test functionality while ensuring CI compatibility
  • This resolves the error: TypeError: (0 , helpers_1.modText) is not a function that was occurring in the CI environment.

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/14664196489
Commit: 4f62c7a
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Fri, 25 Apr 2025 12:53:42 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • Style

    • Updated import order for improved readability and consistency.
  • Tests

    • Added new mock implementations for utility functions and application state to enhance test coverage.

@jacquesikot jacquesikot requested a review from a team as a code owner April 25, 2025 09:31
@jacquesikot jacquesikot requested review from vivek-appsmith and removed request for a team April 25, 2025 09:31
@jacquesikot jacquesikot self-assigned this Apr 25, 2025
Copy link
Contributor

coderabbitai bot commented Apr 25, 2025

Walkthrough

This change reorganizes import statements within the test file for the useTableOrSpreadsheet hook. It introduces multiple new Jest mocks to simulate application state, selectors, and utility functions more comprehensively. These mocks provide default or fixed return values for application mode, environment selectors, and platform-specific helpers. The test logic and assertions remain unchanged, and no exported or public entities are modified.

Changes

File Path Change Summary
app/client/src/components/editorComponents/WidgetQueryGeneratorForm/CommonControls/TableOrSpreadsheetDropdown/useTableOrSpreadsheet.test.ts Reordered imports; added extensive Jest mocks for application selectors, environment selectors, Redux store state, and utility helpers (getAppMode, modText, isMacOrIOS, shiftText). No test logic changes.

Poem

Imports shuffled, mocks in place,
Helpers return with a familiar face.
State and selectors all aligned,
Tests stay steady, well-defined.
🎩✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between a555ca7 and 4f62c7a.

📒 Files selected for processing (1)
  • app/client/src/components/editorComponents/WidgetQueryGeneratorForm/CommonControls/TableOrSpreadsheetDropdown/useTableOrSpreadsheet.test.ts (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/src/components/editorComponents/WidgetQueryGeneratorForm/CommonControls/TableOrSpreadsheetDropdown/useTableOrSpreadsheet.test.ts
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the Bug Something isn't working label Apr 25, 2025
@jacquesikot jacquesikot requested a review from btsgh April 25, 2025 10:26
Copy link
Collaborator

@btsgh btsgh left a comment

Choose a reason for hiding this comment

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

Approving to unblock promotion

@jacquesikot jacquesikot added the ok-to-test Required label for CI label Apr 25, 2025
@jacquesikot jacquesikot merged commit abd27c3 into release Apr 25, 2025
52 checks passed
@jacquesikot jacquesikot deleted the fix/add-proper-mock-for-use-table-or-spreadsheet-unit-test branch April 25, 2025 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working ok-to-test Required label for CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants