Fix Tests and Optimize Code #1873
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request addresses several issues related to testing and code optimization in the
tableproject. 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:
Updated Test Workflow
.github/workflows/test.ymlto automate the testing process. This workflow triggers on pushes to themainbranch and pull requests targetingmain. It includes a job namedapi-teststhat 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.Code Adjustments
api/src/services/datasource.service.tsto use the logical OR operator (||) instead of the nullish coalescing operator (??). This change ensures consistent behavior across different JavaScript environments.api/src/services/job.service.tsfromJobType.RENAME_DATASOURCEtoJobType.FIX_DASHBOARD_PERMISSIONto reflect the current requirements.Test Case Updates
api/tests/e2e/06_query.test.tsandapi/tests/integration/06_query.test.tsto align with the latest query structure. Updated the SQL statements and expected results in the test cases to match the new schema.api/tests/e2e/__snapshots__/06_query.test.ts.snapandapi/tests/integration/__snapshots__/06_query.test.ts.snapto reflect the changes in the query structure.api/tests/integration/12_dashboard_content_changelog.test.tsto ensure they match the current implementation.api/tests/integration/constants.tsto include the newmerico_metric_systemtype.api/tests/unit/validation.test.tsto includemerico_metric_system.Other Changes
.vscode/settings.jsonfile 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