-
Notifications
You must be signed in to change notification settings - Fork 0
feat(column-operations): add uppercase conversion functionality #172
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
Conversation
This commit adds a new feature to the data processing component that allows users to convert the contents of a selected column to uppercase. The changes include: - Implement the `handleUpperCase` function in the `ColumnHeaderMenu.vue` component to handle the uppercase conversion operation. - Add a new test case in `project.replace.test.ts` to verify the basic find and replace functionality. - Implement the `UppercaseConversionService` in `uppercase-conversion.service.ts` to handle the database operations for the uppercase conversion. - Add a new test suite in `uppercase.test.ts` to cover the uppercase conversion API endpoint. These changes provide users with an additional data transformation option, making the application more versatile and user-friendly.
📝 WalkthroughSummary by CodeRabbit
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
backend/src/api/project/index.ts (1)
670-682: Consider extracting the column-existence guard.The same
information_schemacheck and error response now live in the replace, trim, and uppercase handlers. Pulling that guard into a shared helper (e.g.,ensureColumnExists) would shrink the handlers and keep the logic in one spot if we have to tweak the validation again.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
backend/src/api/project/index.ts(4 hunks)backend/src/api/project/schemas.ts(1 hunks)backend/src/services/uppercase-conversion.service.ts(1 hunks)backend/tests/api/project/project.replace.test.ts(3 hunks)backend/tests/api/project/uppercase.test.ts(1 hunks)backend/tests/services/uppercase-conversion.service.test.ts(1 hunks)backend/tests/upload/file-processor.test.ts(0 hunks)frontend/components.d.ts(0 hunks)frontend/src/features/data-processing/components/ColumnHeaderMenu.vue(2 hunks)
💤 Files with no reviewable changes (2)
- backend/tests/upload/file-processor.test.ts
- frontend/components.d.ts
🧰 Additional context used
🧬 Code graph analysis (4)
backend/src/services/uppercase-conversion.service.ts (1)
backend/src/services/column-operation.service.ts (1)
ColumnOperationParams(3-6)
backend/tests/services/uppercase-conversion.service.test.ts (2)
backend/src/services/uppercase-conversion.service.ts (1)
UppercaseConversionService(4-43)backend/src/plugins/database.ts (3)
initializeDb(8-48)getDb(50-55)closeDb(57-63)
backend/src/api/project/index.ts (4)
backend/src/api/project/schemas.ts (2)
AffectedRowsSchema(61-63)ColumnNameSchema(54-59)backend/src/types/error-handler.ts (1)
ApiErrorHandler(6-211)backend/src/services/uppercase-conversion.service.ts (1)
UppercaseConversionService(4-43)backend/src/types/error-schemas.ts (2)
ApiErrors(20-26)ApiErrors(27-27)
backend/tests/api/project/uppercase.test.ts (1)
backend/src/plugins/database.ts (2)
initializeDb(8-48)closeDb(57-63)
| expect(service.performOperation({ | ||
| table: 'test', | ||
| column: 'name', | ||
| })).resolves.toBe(4) // John Doe, Jane Smith, bob johnson, Charlie Green should be affected | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Await the promise before asserting .resolves
These .resolves assertions are never awaited (nor returned), so the test finishes before the expectation runs. That turns failures into silent passes and can even race with the subsequent verification queries. Add await (or return the promise) for each .resolves usage in this file.
- expect(service.performOperation({
- table: 'test',
- column: 'name',
- })).resolves.toBe(4)
+ await expect(service.performOperation({
+ table: 'test',
+ column: 'name',
+ })).resolves.toBe(4)Repeat the same fix for the other .resolves assertions below (empty strings, all-uppercase, special characters, unicode, etc.) so every async expectation is awaited.
Also applies to: 79-83, 174-177, 202-205, 242-245
🤖 Prompt for AI Agents
In backend/tests/services/uppercase-conversion.service.test.ts around lines
42-46 (and also apply the same change at 79-83, 174-177, 202-205, 242-245), the
test uses expect(...).resolves without awaiting or returning the promise which
allows the test to finish before the assertion runs; update each
expect(...).resolves to be awaited (e.g. await expect(...).resolves.toBe(...) or
return the promise) so the assertions run before the test completes and prevent
silent passes or race conditions with subsequent verification queries.
This commit adds a new feature to the data processing component that allows users to convert the contents of a selected column to uppercase. The changes include:
handleUpperCasefunction in theColumnHeaderMenu.vuecomponent to handle the uppercase conversion operation.project.replace.test.tsto verify the basic find and replace functionality.UppercaseConversionServiceinuppercase-conversion.service.tsto handle the database operations for the uppercase conversion.uppercase.test.tsto cover the uppercase conversion API endpoint.These changes provide users with an additional data transformation option, making the application more versatile and user-friendly.