@@ -25,15 +25,15 @@ func TestCreate(t *testing.T) {
25
25
mbtest .AssertTestdata (t , "groupRequestCreateObject.json" , mbtest .Request .Body )
26
26
27
27
if group .Name != "Friends" {
28
- t .Fatalf ("expected Friends, got %s" , group .Name )
28
+ t .Fatalf ("got %s, expected Friends " , group .Name )
29
29
}
30
30
}
31
31
32
32
func TestCreateWithEmptyName (t * testing.T ) {
33
33
client := mbtest .Client (t )
34
34
35
35
if _ , err := Create (client , & Request {"" }); err == nil {
36
- t .Fatalf ("expected error, got nil " )
36
+ t .Fatalf ("got nil, expected error " )
37
37
}
38
38
}
39
39
@@ -58,31 +58,31 @@ func TestList(t *testing.T) {
58
58
}
59
59
60
60
if list .Offset != 0 {
61
- t .Fatalf ("expected 0, got %d" , list .Offset )
61
+ t .Fatalf ("got %d, expected 0 " , list .Offset )
62
62
}
63
63
64
64
if list .Limit != 10 {
65
- t .Fatalf ("expected 10, got %d" , list .Limit )
65
+ t .Fatalf ("got %d, expected 10 " , list .Limit )
66
66
}
67
67
68
68
if list .Count != 2 {
69
- t .Fatalf ("expected 2, got %d" , list .Count )
69
+ t .Fatalf ("got %d, expected 2 " , list .Count )
70
70
}
71
71
72
72
if list .TotalCount != 2 {
73
- t .Fatalf ("expected 2, got %d" , list .TotalCount )
73
+ t .Fatalf ("got %d, expected 2 " , list .TotalCount )
74
74
}
75
75
76
76
if actualCount := len (list .Items ); actualCount != 2 {
77
- t .Fatalf ("expected 2, got %d" , actualCount )
77
+ t .Fatalf ("got %d, expected 2 " , actualCount )
78
78
}
79
79
80
80
if list .Items [0 ].ID != "first-id" {
81
- t .Fatalf ("expected first-id, got %s " , list .Items [0 ].ID )
81
+ t .Fatalf ("got %s, expected first-id" , list .Items [0 ].ID )
82
82
}
83
83
84
84
if list .Items [1 ].ID != "second-id" {
85
- t .Fatalf ("expected second-id, got %s " , list .Items [1 ].ID )
85
+ t .Fatalf ("got %s, expected second-id" , list .Items [1 ].ID )
86
86
}
87
87
88
88
mbtest .AssertEndpointCalled (t , http .MethodGet , "/groups" )
@@ -104,7 +104,7 @@ func TestListPagination(t *testing.T) {
104
104
List (client , tc .options )
105
105
106
106
if query := mbtest .Request .URL .RawQuery ; query != tc .expected {
107
- t .Fatalf ("expected %s, got %s" , tc .expected , query )
107
+ t .Fatalf ("got %s, expected %s" , tc .expected , query )
108
108
}
109
109
}
110
110
}
@@ -121,31 +121,31 @@ func TestRead(t *testing.T) {
121
121
mbtest .AssertEndpointCalled (t , http .MethodGet , "/groups/group-id" )
122
122
123
123
if group .ID != "group-id" {
124
- t .Fatalf ("expected group-id, got %s " , group .ID )
124
+ t .Fatalf ("got %s, expected group-id" , group .ID )
125
125
}
126
126
127
127
if group .HRef != "https://rest.messagebird.com/groups/group-id" {
128
- t .Fatalf ("expected https://rest.messagebird.com/groups/group-id, got %s " , group .HRef )
128
+ t .Fatalf ("got %s, expected https://rest.messagebird.com/groups/group-id" , group .HRef )
129
129
}
130
130
131
131
if group .Name != "Friends" {
132
- t .Fatalf ("expected Friends, got %s" , group .Name )
132
+ t .Fatalf ("got %s, expected Friends " , group .Name )
133
133
}
134
134
135
135
if group .Contacts .TotalCount != 3 {
136
- t .Fatalf ("expected 3, got %d" , group .Contacts .TotalCount )
136
+ t .Fatalf ("got %d, expected 3 " , group .Contacts .TotalCount )
137
137
}
138
138
139
139
if group .Contacts .HRef != "https://rest.messagebird.com/groups/group-id" {
140
- t .Fatalf ("expected https://rest.messagebird.com/groups/group-id, got %s " , group .Contacts .HRef )
140
+ t .Fatalf ("got %s, expected https://rest.messagebird.com/groups/group-id" , group .Contacts .HRef )
141
141
}
142
142
143
143
if created , _ := time .Parse (time .RFC3339 , "2018-07-25T12:16:10+00:00" ); ! created .Equal (group .CreatedDatetime ) {
144
- t .Fatalf ("expected 2018-07-25T12:16:10+00:00, got %s " , group .CreatedDatetime )
144
+ t .Fatalf ("got %s, expected 2018-07-25T12:16:10+00:00" , group .CreatedDatetime )
145
145
}
146
146
147
147
if updated , _ := time .Parse (time .RFC3339 , "2018-07-25T12:16:23+00:00" ); ! updated .Equal (group .UpdatedDatetime ) {
148
- t .Fatalf ("expected 2018-07-25T12:16:23+00:00, got %s " , group .UpdatedDatetime )
148
+ t .Fatalf ("got %s, expected 2018-07-25T12:16:23+00:00" , group .UpdatedDatetime )
149
149
}
150
150
}
151
151
@@ -172,7 +172,7 @@ func TestAddContacts(t *testing.T) {
172
172
mbtest .AssertEndpointCalled (t , http .MethodGet , "/groups/group-id/contacts" )
173
173
174
174
if mbtest .Request .URL .RawQuery != "_method=PUT&ids[]=first-contact-id&ids[]=second-contact-id" {
175
- t .Fatalf ("expected _method=PUT&ids[]=first-contact-id&ids[]=second-contact-id, got %s " , mbtest .Request .URL .RawQuery )
175
+ t .Fatalf ("got %s, expected _method=PUT&ids[]=first-contact-id&ids[]=second-contact-id" , mbtest .Request .URL .RawQuery )
176
176
}
177
177
}
178
178
@@ -188,7 +188,7 @@ func TestAddContactsWithEmptyContacts(t *testing.T) {
188
188
189
189
for _ , tc := range tt {
190
190
if err := AddContacts (client , "group-id" , tc .contactIDs ); err == nil {
191
- t .Fatalf ("expected error, got nil " )
191
+ t .Fatalf ("got nil, expected error " )
192
192
}
193
193
}
194
194
}
@@ -200,7 +200,7 @@ func TestAddContactsWithTooManyContacts(t *testing.T) {
200
200
contactIDs := make ([]string , 51 )
201
201
202
202
if err := AddContacts (client , "group-id" , contactIDs ); err == nil {
203
- t .Fatalf ("expected error, got nil " )
203
+ t .Fatalf ("got nil, expected error " )
204
204
}
205
205
}
206
206
@@ -214,31 +214,31 @@ func TestListContacts(t *testing.T) {
214
214
}
215
215
216
216
if list .Offset != 0 {
217
- t .Fatalf ("expected 0, got %d" , list .Offset )
217
+ t .Fatalf ("got %d, expected 0 " , list .Offset )
218
218
}
219
219
220
220
if list .Limit != 20 {
221
- t .Fatalf ("expected 20, got %d" , list .Limit )
221
+ t .Fatalf ("got %d, expected 20 " , list .Limit )
222
222
}
223
223
224
224
if list .Count != 3 {
225
- t .Fatalf ("expected 3, got %d" , list .Count )
225
+ t .Fatalf ("got %d, expected 3 " , list .Count )
226
226
}
227
227
228
228
if list .TotalCount != 3 {
229
- t .Fatalf ("expected 3, got %d" , list .TotalCount )
229
+ t .Fatalf ("got %d, expected 3 " , list .TotalCount )
230
230
}
231
231
232
232
if list .Items [0 ].ID != "first-contact-id" {
233
- t .Fatalf ("expected first-contact-id, got %s " , list .Items [0 ].ID )
233
+ t .Fatalf ("got %s, expected first-contact-id" , list .Items [0 ].ID )
234
234
}
235
235
236
236
if list .Items [1 ].ID != "second-contact-id" {
237
- t .Fatalf ("expected second-contact-id, got %s " , list .Items [1 ].ID )
237
+ t .Fatalf ("got %s, expected second-contact-id" , list .Items [1 ].ID )
238
238
}
239
239
240
240
if list .Items [2 ].ID != "third-contact-id" {
241
- t .Fatalf ("expected third-contact-id, got %s " , list .Items [2 ].ID )
241
+ t .Fatalf ("got %s, expected third-contact-id" , list .Items [2 ].ID )
242
242
}
243
243
244
244
mbtest .AssertEndpointCalled (t , http .MethodGet , "/groups/group-id/contacts" )
0 commit comments