Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func TestRequestDto(t *testing.T) {
- testCases := []struct {
- desc string
- input GetCategoryRequestDto
- expect error
- }{
- {
- desc: "is valid dto",
- input: GetCategoryRequestDto{
- ID: "00000000-0000-0000-1000-000000000000",
- },
- expect: nil,
- },
- {
- desc: "not valid dto: ID is not uuid",
- input: GetCategoryRequestDto{
- ID: "00000000-0000-0000-1000",
- },
- expect: InvalidUUIDErr,
- },
- }
- for _, tc := range testCases {
- t.Run(tc.desc, func(t *testing.T) {
- got := tc.input.Validate()
- if !errors.Is(got, tc.expect) {
- t.Errorf("Incorrected result. Expect %s, got nil", tc.expect)
- }
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement