Skip to content

tests: assert belongs-to association errors explicitly#7739

Open
tangerineyu wants to merge 1 commit intogo-gorm:masterfrom
tangerineyu:tests/belongs-to-error-check
Open

tests: assert belongs-to association errors explicitly#7739
tangerineyu wants to merge 1 commit intogo-gorm:masterfrom
tangerineyu:tests/belongs-to-error-check

Conversation

@tangerineyu
Copy link
Copy Markdown

Summary

  • assert setup and association operation errors explicitly in belongs-to association tests
  • make the single-record and slice belongs-to tests fail fast instead of continuing after silent failures
  • tests: assert belongs-to association errors explicitly

@propel-code-bot
Copy link
Copy Markdown
Contributor

Add explicit error checks in belongs-to association tests

This PR updates belongs-to association tests to explicitly check errors for setup and association operations, converting silent failures into fail-fast assertions. It adds error handling for Create, First, Find, Append, Clear, and Delete calls in TestBelongsToAssociation and TestBelongsToAssociationForSlice.

Key Changes

• Added explicit error checks with t.Fatalf for DB.First, association Find, and association Append calls in TestBelongsToAssociation
• Added error handling for DB.Create, association Find, Append, Clear, and shared company Delete in TestBelongsToAssociationForSlice

Affected Areas

tests/associations_belongs_to_test.go
TestBelongsToAssociation
TestBelongsToAssociationForSlice

This summary was automatically generated by @propel-code-bot

Copy link
Copy Markdown
Contributor

@propel-code-bot propel-code-bot Bot left a comment

Choose a reason for hiding this comment

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

No issues found; changes add clear fail-fast error assertions to tests.

Status: No Issues Found | Risk: Low

Review Details

📁 1 files reviewed | 💬 0 comments

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.

1 participant