Skip to content

fix: Update SQL mock expectations for recent schema changes#186

Merged
mushrafmim merged 1 commit intoOpenNSW:mainfrom
ginaxu1:fix-unit-tests
Feb 26, 2026
Merged

fix: Update SQL mock expectations for recent schema changes#186
mushrafmim merged 1 commit intoOpenNSW:mainfrom
ginaxu1:fix-unit-tests

Conversation

@ginaxu1
Copy link
Contributor

@ginaxu1 ginaxu1 commented Feb 25, 2026

Testing

cd backend
go test ./... -count=1

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ginaxu1, 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 addresses necessary updates to SQL mock expectations within the test suite. These changes ensure that the tests accurately reflect recent modifications to the database schema for both consignments and workflow_nodes tables, preventing test failures due to schema mismatches and maintaining test reliability.

Highlights

  • Consignment Service Test Updates: Updated SQL mock expectations in consignment_service_test.go for INSERT and UPDATE operations on the consignments table to reflect the addition of the end_node_id column. A new SELECT mock was also introduced for consignments.
  • Workflow Node Service Test Updates: Adjusted SQL mock expectations in workflow_node_service_test.go for INSERT and UPDATE operations on the workflow_nodes table to accommodate the new outcome and unlock_configuration columns.
Changelog
  • backend/internal/workflow/service/consignment_service_test.go
    • Increased the number of sqlmock.AnyArg() arguments for the INSERT INTO "consignments" expectation to match the updated schema.
    • Modified the UPDATE "consignments" expectation to include the newly added end_node_id column in the SET clause and adjusted parameter indexing.
    • Added a new sqlMock.ExpectQuery for SELECT * FROM "consignments" to support a new read operation in TestConsignmentService_UpdateWorkflowNodeState_Completion.
  • backend/internal/workflow/service/workflow_node_service_test.go
    • Increased the number of sqlmock.AnyArg() arguments for the INSERT INTO "workflow_nodes" expectation to match the updated schema.
    • Modified the UPDATE "workflow_nodes" expectation to include the new outcome and unlock_configuration columns in the SET clause and adjusted parameter indexing.
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 updates SQL mock expectations in tests to align with recent database schema changes. The changes correctly adjust the number of arguments for INSERT and UPDATE statements in consignment_service_test.go and workflow_node_service_test.go.

I've found one issue in a newly added mock expectation in consignment_service_test.go where the number of arguments in WithArgs does not match the query placeholders. Please see my detailed comment.

@mushrafmim mushrafmim merged commit da42f89 into OpenNSW:main Feb 26, 2026
3 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.

3 participants