@@ -148,17 +148,24 @@ func TestGetNonExistingUser(t *testing.T) {
148
148
s := echoServer ([]byte (resp ), t )
149
149
defer s .Close ()
150
150
151
- user , err := s .Client .GetUser (context .Background (), "ignored_id" )
152
- if user != nil || err == nil {
153
- t .Errorf ("GetUser(non-existing) = (%v, %v); want = (nil, error)" , user , err )
151
+ want := "cannot find user given params: id:[%s], phone:[%s], email: [%s]"
152
+
153
+ we := fmt .Sprintf (want , "id-nonexisting" , "" , "" )
154
+ user , err := s .Client .GetUser (context .Background (), "id-nonexisting" )
155
+ if user != nil || err == nil || err .Error () != we {
156
+ t .Errorf ("GetUser(non-existing) = (%v, %q); want = (nil, %q)" , user , err , we )
154
157
}
155
- user ,
err = s .
Client .
GetUserByEmail (
context .
Background (),
"[email protected] " )
156
- if user != nil || err == nil {
157
- t .Errorf ("GetUserByEmail(non-existing) = (%v, %v); want = (nil, error)" , user , err )
158
+
159
+ we = fmt .
Sprintf (
want ,
"" ,
"" ,
"[email protected] " )
160
+ user ,
err = s .
Client .
GetUserByEmail (
context .
Background (),
"[email protected] " )
161
+ if user != nil || err == nil || err .Error () != we {
162
+ t .Errorf ("GetUserByEmail(non-existing) = (%v, %q); want = (nil, %q)" , user , err , we )
158
163
}
159
- user , err = s .Client .GetUserByPhoneNumber (context .Background (), "+1234567890" )
160
- if user != nil || err == nil {
161
- t .Errorf ("GetUserPhoneNumber(non-existing) = (%v, %v); want = (nil, error)" , user , err )
164
+
165
+ we = fmt .Sprintf (want , "" , "+12345678901" , "" )
166
+ user , err = s .Client .GetUserByPhoneNumber (context .Background (), "+12345678901" )
167
+ if user != nil || err == nil || err .Error () != we {
168
+ t .Errorf ("GetUserPhoneNumber(non-existing) = (%v, %q); want = (nil, %q)" , user , err , we )
162
169
}
163
170
}
164
171
0 commit comments