@@ -11,7 +11,7 @@ import (
1111
1212type mockTestingFatalf struct {
1313 failed bool
14- err string
14+ err string
1515}
1616
1717func (m * mockTestingFatalf ) Fatalf (format string , args ... any ) {
@@ -22,11 +22,9 @@ func (m *mockTestingFatalf) Fatalf(format string, args ...any) {
2222
2323func TestCollectAllNestedIdsFromObjects (t * testing.T ) {
2424 data := []interface {}{
25- map [string ]interface {}{"routes" :
26- []interface {}{"234" , "235" },
25+ map [string ]interface {}{"routes" : []interface {}{"234" , "235" },
2726 },
28- map [string ]interface {}{"routes" :
29- []interface {}{"345" },
27+ map [string ]interface {}{"routes" : []interface {}{"345" },
3028 },
3129 }
3230 expected := []string {"234" , "235" , "345" }
@@ -42,33 +40,32 @@ func TestCollectAllNestedIdsFromObjectsFailures(t *testing.T) {
4240 expectedError string
4341 }{
4442 {
45- name : "Invalid object type in the array" ,
46- data : []interface {}{
47- map [int ]interface {}{1 : "234" },
48- },
43+ name : "Invalid object type in the array" ,
44+ data : []interface {}{
45+ map [int ]interface {}{1 : "234" },
46+ },
4947 expectedError : "item 0 is not a map[string]interface{}" ,
5048 },
5149 {
52- name : "Missing key from the object" ,
53- data : []interface {}{
54- map [string ]interface {}{"id" : "234" },
55- },
50+ name : "Missing key from the object" ,
51+ data : []interface {}{
52+ map [string ]interface {}{"id" : "234" },
53+ },
5654 expectedError : "item 0 missing key \" routes\" " ,
5755 },
5856 {
59- name : "Invalid nested object" ,
60- data : []interface {}{
61- map [string ]interface {}{"routes" : "234" },
62- },
57+ name : "Invalid nested object" ,
58+ data : []interface {}{
59+ map [string ]interface {}{"routes" : "234" },
60+ },
6361 expectedError : "item 0 key \" routes\" is not a []interface{}: string" ,
6462 },
6563 {
66- name : "Invalid nested array type" ,
67- data : []interface {}{
68- map [string ]interface {}{"routes" :
69- []interface {}{234 },
70- },
71- },
64+ name : "Invalid nested array type" ,
65+ data : []interface {}{
66+ map [string ]interface {}{"routes" : []interface {}{234 },
67+ },
68+ },
7269 expectedError : "item 0 key \" routes\" index 0 is not a string: int" ,
7370 },
7471 }
@@ -109,24 +106,24 @@ func TestCollectAllIdsFromObjectsFailures(t *testing.T) {
109106 expectedError string
110107 }{
111108 {
112- name : "Invalid object type in the array" ,
113- data : []interface {}{
114- map [int ]interface {}{1 : "234" },
115- },
109+ name : "Invalid object type in the array" ,
110+ data : []interface {}{
111+ map [int ]interface {}{1 : "234" },
112+ },
116113 expectedError : "item 0 is not a map[string]interface{}" ,
117114 },
118115 {
119- name : "Missing key from the object" ,
120- data : []interface {}{
121- map [string ]interface {}{"name" : "234" },
122- },
116+ name : "Missing key from the object" ,
117+ data : []interface {}{
118+ map [string ]interface {}{"name" : "234" },
119+ },
123120 expectedError : "item 0 missing key \" id\" " ,
124121 },
125122 {
126- name : "Invalid nested object" ,
127- data : []interface {}{
128- map [string ]interface {}{"id" : 234 },
129- },
123+ name : "Invalid nested object" ,
124+ data : []interface {}{
125+ map [string ]interface {}{"id" : 234 },
126+ },
130127 expectedError : "item 0 key \" id\" is not a string: int" ,
131128 },
132129 }
0 commit comments