Skip to content

Conversation

@narrowizard
Copy link
Contributor

This pull request addresses several issues related to testing and code optimization in the table project. The primary goals of this update are to enhance the reliability of our tests, improve code readability, and ensure that our project adheres to best practices.

Changes Made:

  1. Updated Test Workflow

    • Added a new GitHub Actions workflow file .github/workflows/test.yml to automate the testing process. This workflow triggers on pushes to the main branch and pull requests targeting main. It includes a job named api-tests that runs on the latest Ubuntu environment and utilizes a PostgreSQL database service. The job steps cover dependency installation, project building, and running unit, integration, and end-to-end tests. Additionally, it uploads test coverage reports.
  2. Code Adjustments

    • Modified the error message handling in api/src/services/datasource.service.ts to use the logical OR operator (||) instead of the nullish coalescing operator (??). This change ensures consistent behavior across different JavaScript environments.
    • Updated the job type condition in api/src/services/job.service.ts from JobType.RENAME_DATASOURCE to JobType.FIX_DASHBOARD_PERMISSION to reflect the current requirements.
  3. Test Case Updates

    • Adjusted the logic in api/tests/e2e/06_query.test.ts and api/tests/integration/06_query.test.ts to align with the latest query structure. Updated the SQL statements and expected results in the test cases to match the new schema.
    • Updated the snapshot files api/tests/e2e/__snapshots__/06_query.test.ts.snap and api/tests/integration/__snapshots__/06_query.test.ts.snap to reflect the changes in the query structure.
    • Modified the expected results in api/tests/integration/12_dashboard_content_changelog.test.ts to ensure they match the current implementation.
    • Updated the query configuration constants in api/tests/integration/constants.ts to include the new merico_metric_system type.
    • Adjusted the valid query request types in api/tests/unit/validation.test.ts to include merico_metric_system.
  4. Other Changes

    • Removed the unnecessary .vscode/settings.json file to declutter the project directory.

Testing:
All tests have been run successfully on my local machine, and the new workflow has been validated to ensure it triggers correctly and executes the tests as expected.

Review Request:
I kindly ask for a thorough review of these changes to ensure they meet our project standards and do not introduce any unintended side effects. Your feedback and approval are essential to maintain the quality and stability of our codebase.

Thank you for your attention to this pull request.

Best regards,
Narro

Close #1871

…ervice bug

- Fix job service: use FIX_DASHBOARD_PERMISSION job type in second query
- Update query tests: change sql property to config structure with _type
- Update changelog tests: adjust diff line numbers after config structure change
- Fix error handling: use || instead of ?? for better error message fallback
- Update validation test: include merico_metric_system in type enum
- Add .vscode/ to gitignore

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@narrowizard narrowizard force-pushed the fix-test branch 7 times, most recently from bebfe82 to 11b0705 Compare January 5, 2026 11:18
Add test.yml workflow to run all API tests (unit, integration, e2e)
on push and pull_request to main branch.

- Includes PostgreSQL 17 service container
- Builds dashboard and settings-form as prerequisites
- Runs test:u, test:i, and test:e2e sequentially
- Uploads coverage reports to Codecov

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

fix: Add --skipLibCheck to build scripts to fix TypeScript 5.7 compatibility

TypeScript 5.7.3 (used in root) has stricter parsing that breaks with
Mantine 7.17.8 type definitions. Adding --skipLibCheck flag to tsc
commands skips node_modules type checking while still validating
project source code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

ci: Remove unnecessary dashboard/settings-form build from test workflow

API tests don't import or depend on dashboard or settings-form packages.
Building them only adds overhead and exposes unrelated TypeScript/Mantine
compatibility issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov-commenter
Copy link

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@ZeekoZhu ZeekoZhu merged commit 3657ae9 into merico-dev:main Jan 6, 2026
3 of 4 checks passed
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.

API Tests Are Failing and Need to Be Fixed, and Suggest Adding Tests to CI

3 participants