-
Notifications
You must be signed in to change notification settings - Fork 1
Add tests for Boolean DataType #92
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
base: main
Are you sure you want to change the base?
Conversation
|
||
func TestBooleanNegativeInvalidDBValue(t *testing.T) { | ||
// Insert invalid value directly (bypassing GORM) | ||
if err := DB.Exec("INSERT INTO BOOLEAN_TEST (ID, FLAG) VALUES (999, 2)").Error; err != nil { |
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.
shouldn't the table name be "boolean_tests"?
DB.Create(&BooleanTest{Flag: false}) | ||
|
||
var trues []BooleanTest | ||
if err := DB.Where("FLAG = ?", true).Find(&trues).Error; err != nil { |
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.
after Find(&trues)
, add an assert for the expected number of rows (or at least that >= 1 rows were returned).
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.
something like:
if len(trues) == 0 { t.Fatalf("expected at least 1 row, got 0") }
"testing" | ||
) | ||
|
||
type BooleanTest struct { |
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.
Please add a test for using int number for Boolean column
No description provided.