-
Notifications
You must be signed in to change notification settings - Fork 86
Table driven tests for SimpleType, EnumType and ListType. #115
Conversation
Good stuff! Having the tests in place will help us as we extend the system. Review status: 0 of 2 files reviewed at latest revision, 5 unresolved discussions, some commit checks failed. models/fieldtype_test.go, line 17 [r1] (raw file):
I would suggest that we add a check whether an error should be returnd. It is possible that 'nil' is actually a proper return value and not an error condition. models/fieldtype_test.go, line 49 [r1] (raw file):
I would suggest if retVal == inp.expectedValue && (err != nil) == inp.errorExpected { models/fieldtype_test.go, line 50 [r1] (raw file):
I think t.Log() would be better, because it's controlled by the -v flag in "go test". models/simple_type.go, line 34 [r1] (raw file):
It's already a boolean value, no need for the "== true" models/simple_type.go, line 39 [r1] (raw file):
the comment needs to be moved to the next case Comments from Reviewable |
Review status: 0 of 2 files reviewed at latest revision, 5 unresolved discussions, some commit checks failed. models/fieldtype_test.go, line 17 [r1] (raw file):
|
import "testing" | ||
|
||
var stString = SimpleType{KindString} | ||
var stInt = SimpleType{KindInteger} |
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.
Variable declaration can be factored into blocks. e.g., https://tour.golang.org/basics/11
Reviewed 3 of 4 files at r2, 2 of 2 files at r3. Comments from Reviewable |
Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. models/fieldtype_test.go, line 56 [r3] (raw file):
|
Reviewed 3 of 4 files at r2, 2 of 2 files at r3. Comments from Reviewable |
added pkg govalidator to glide
These test cases are testing ConvertToModel function of the Type. Also added fixes in existing ConvertToModel as needed. Few validations are added in Conversion logic. govalidator lib is added for the validations like IsURL. Fixes: fabric8-services#77
Simple table driven testing of
ConvertToModel
for SimpleType, EnumType, ListType done.Testing is never complete 😅 so removing label WIP.
We should be adding more and more tests on the go.
This change is