You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// an empty hub is valid, and should not have warnings
63
-
hub, err:=testHub(t, nil, "{}")
61
+
hub, err:=testHub(t, "{}")
64
62
require.NoError(t, err)
65
63
assert.Empty(t, hub.Warnings)
66
64
}
67
65
68
66
funcTestIndexJSON(t*testing.T) {
69
67
// but it can't be an empty string
70
-
hub, err:=testHub(t, nil, "")
68
+
hub, err:=testHub(t, "")
71
69
cstest.RequireErrorContains(t, err, "invalid hub index: failed to parse index: unexpected end of JSON input")
72
70
assert.NotNil(t, hub)
73
71
assert.Empty(t, hub.Warnings)
74
72
75
73
// it must be valid json
76
-
hub, err=testHub(t, nil, "def not json")
74
+
hub, err=testHub(t, "def not json")
77
75
cstest.RequireErrorContains(t, err, "invalid hub index: failed to parse index: invalid character 'd' looking for beginning of value. Run 'sudo cscli hub update' to download the index again")
78
76
assert.NotNil(t, hub)
79
77
assert.Empty(t, hub.Warnings)
80
78
81
-
hub, err=testHub(t, nil, "{")
79
+
hub, err=testHub(t, "{")
82
80
cstest.RequireErrorContains(t, err, "invalid hub index: failed to parse index: unexpected end of JSON input")
83
81
assert.NotNil(t, hub)
84
82
assert.Empty(t, hub.Warnings)
85
83
86
84
// and by json we mean an object
87
-
hub, err=testHub(t, nil, "[]")
85
+
hub, err=testHub(t, "[]")
88
86
cstest.RequireErrorContains(t, err, "invalid hub index: failed to parse index: json: cannot unmarshal array into Go value of type cwhub.HubItems")
89
87
assert.NotNil(t, hub)
90
88
assert.Empty(t, hub.Warnings)
91
89
}
92
90
93
91
funcTestIndexUnknownItemType(t*testing.T) {
94
92
// Allow unknown fields in the top level object, likely new item types
95
-
hub, err:=testHub(t, nil, `{"goodies": {}}`)
93
+
hub, err:=testHub(t, `{"goodies": {}}`)
96
94
require.NoError(t, err)
97
95
assert.Empty(t, hub.Warnings)
98
96
}
99
97
100
98
funcTestHubUpdate(t*testing.T) {
101
99
ctx:=t.Context()
102
100
// update an empty hub with a index containing a parser.
0 commit comments