@@ -281,7 +281,7 @@ func TestProjectsService_ListProjectFieldsForOrg(t *testing.T) {
281
281
testFormValues (t , r , values {"q" : "text" , "after" : "2" , "before" : "1" })
282
282
fmt .Fprint (w , `[
283
283
{
284
- "id": "field1" ,
284
+ "id": 1 ,
285
285
"node_id": "node_1",
286
286
"name": "Status",
287
287
"dataType": "single_select",
@@ -303,7 +303,7 @@ func TestProjectsService_ListProjectFieldsForOrg(t *testing.T) {
303
303
"updated_at": "2012-01-02T15:04:05Z"
304
304
},
305
305
{
306
- "id": "field2" ,
306
+ "id": 2 ,
307
307
"node_id": "node_2",
308
308
"name": "Priority",
309
309
"dataType": "text",
@@ -327,8 +327,8 @@ func TestProjectsService_ListProjectFieldsForOrg(t *testing.T) {
327
327
328
328
// Validate first field (with options)
329
329
field1 := fields [0 ]
330
- if field1 .ID != " field1" || field1 .Name != "Status" || field1 .DataType != "single_select" {
331
- t .Errorf ("First field: got ID=%s , Name=%s, DataType=%s; want field1 , Status, single_select" ,
330
+ if field1 .ID == nil || * field1 . ID != 1 || field1 .Name != "Status" || field1 .DataType != "single_select" {
331
+ t .Errorf ("First field: got ID=%v , Name=%s, DataType=%s; want 1 , Status, single_select" ,
332
332
field1 .ID , field1 .Name , field1 .DataType )
333
333
}
334
334
if len (field1 .Options ) != 2 {
@@ -341,8 +341,8 @@ func TestProjectsService_ListProjectFieldsForOrg(t *testing.T) {
341
341
342
342
// Validate second field (without options)
343
343
field2 := fields [1 ]
344
- if field2 .ID != " field2" || field2 .Name != "Priority" || field2 .DataType != "text" {
345
- t .Errorf ("Second field: got ID=%s , Name=%s, DataType=%s; want field2 , Priority, text" ,
344
+ if field2 .ID == nil || * field2 . ID != 2 || field2 .Name != "Priority" || field2 .DataType != "text" {
345
+ t .Errorf ("Second field: got ID=%v , Name=%s, DataType=%s; want 2 , Priority, text" ,
346
346
field2 .ID , field2 .Name , field2 .DataType )
347
347
}
348
348
if len (field2 .Options ) != 0 {
@@ -382,13 +382,13 @@ func TestProjectsService_ListProjectFieldsForOrg_pagination(t *testing.T) {
382
382
if after == "" && before == "" {
383
383
// first request
384
384
w .Header ().Set ("Link" , "<http://example.org/orgs/o/projectsV2/1/fields?after=cursor2>; rel=\" next\" " )
385
- fmt .Fprint (w , `[{"id":"field1" ,"name":"Status","dataType":"single_select","created_at":"2011-01-02T15:04:05Z","updated_at":"2012-01-02T15:04:05Z"}]` )
385
+ fmt .Fprint (w , `[{"id":1 ,"name":"Status","dataType":"single_select","created_at":"2011-01-02T15:04:05Z","updated_at":"2012-01-02T15:04:05Z"}]` )
386
386
return
387
387
}
388
388
if after == "cursor2" {
389
389
// second request simulates a previous link
390
390
w .Header ().Set ("Link" , "<http://example.org/orgs/o/projectsV2/1/fields?before=cursor2>; rel=\" prev\" " )
391
- fmt .Fprint (w , `[{"id":"field2" ,"name":"Priority","dataType":"text","created_at":"2011-01-02T15:04:05Z","updated_at":"2012-01-02T15:04:05Z"}]` )
391
+ fmt .Fprint (w , `[{"id":2 ,"name":"Priority","dataType":"text","created_at":"2011-01-02T15:04:05Z","updated_at":"2012-01-02T15:04:05Z"}]` )
392
392
return
393
393
}
394
394
// unexpected state
@@ -400,7 +400,7 @@ func TestProjectsService_ListProjectFieldsForOrg_pagination(t *testing.T) {
400
400
if err != nil {
401
401
t .Fatalf ("first page error: %v" , err )
402
402
}
403
- if len (first ) != 1 || first [0 ].ID != "field1" {
403
+ if len (first ) != 1 || first [0 ].ID == nil || * first [ 0 ]. ID != 1 {
404
404
t .Fatalf ("unexpected first page %+v" , first )
405
405
}
406
406
if resp .After != "cursor2" {
@@ -413,7 +413,7 @@ func TestProjectsService_ListProjectFieldsForOrg_pagination(t *testing.T) {
413
413
if err != nil {
414
414
t .Fatalf ("second page error: %v" , err )
415
415
}
416
- if len (second ) != 1 || second [0 ].ID != "field2" {
416
+ if len (second ) != 1 || second [0 ].ID == nil || * second [ 0 ]. ID != 2 {
417
417
t .Fatalf ("unexpected second page %+v" , second )
418
418
}
419
419
if resp2 .Before != "cursor2" {
@@ -454,7 +454,7 @@ func TestProjectV2Field_Marshal(t *testing.T) {
454
454
testJSONMarshal (t , & ProjectV2FieldOption {}, "{}" )
455
455
456
456
field := & ProjectV2Field {
457
- ID : "field1" ,
457
+ ID : Ptr ( int64 ( 1 )) ,
458
458
NodeID : "node_1" ,
459
459
Name : "Status" ,
460
460
DataType : "single_select" ,
@@ -472,14 +472,14 @@ func TestProjectV2Field_Marshal(t *testing.T) {
472
472
}
473
473
474
474
want := `{
475
- "id": "field1" ,
475
+ "id": 1 ,
476
476
"node_id": "node_1",
477
477
"name": "Status",
478
478
"dataType": "single_select",
479
479
"url": "https://api.github.com/projects/1/fields/field1",
480
480
"options": [
481
481
{
482
- "id": "option1",
482
+ "id": "option1",
483
483
"name": "Todo",
484
484
"color": "blue",
485
485
"description": "Tasks to be done"
0 commit comments