Skip to content

Commit aa8da35

Browse files
committed
fix: minor refactor in builder_test
1 parent b8b0ceb commit aa8da35

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

listener/apischema/builder_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ import (
1212
"k8s.io/kube-openapi/pkg/validation/spec"
1313
)
1414

15+
type fakeClient struct {
16+
paths map[string]openapi.GroupVersion
17+
}
18+
19+
func (f *fakeClient) Paths() (map[string]openapi.GroupVersion, error) {
20+
return f.paths, nil
21+
}
22+
23+
type fakeErrClient struct{}
24+
25+
func (f *fakeErrClient) Paths() (map[string]openapi.GroupVersion, error) {
26+
return nil, errors.New("fail Paths")
27+
}
28+
1529
// TestGetOpenAPISchemaKey tests the getOpenAPISchemaKey function. It checks if the
1630
// function correctly formats the GroupVersionKind into the expected schema key format.
1731
func TestGetOpenAPISchemaKey(t *testing.T) {
@@ -90,20 +104,6 @@ func TestGetCRDGroupVersionKind(t *testing.T) {
90104
}
91105
}
92106

93-
type fakeClient struct {
94-
paths map[string]openapi.GroupVersion
95-
}
96-
97-
func (f *fakeClient) Paths() (map[string]openapi.GroupVersion, error) {
98-
return f.paths, nil
99-
}
100-
101-
type fakeErrClient struct{}
102-
103-
func (f *fakeErrClient) Paths() (map[string]openapi.GroupVersion, error) {
104-
return nil, errors.New("fail Paths")
105-
}
106-
107107
// TestNewSchemaBuilder tests the NewSchemaBuilder function. It checks if the
108108
// SchemaBuilder is correctly initialized with the expected number of schemas
109109
// and the expected schema key.
@@ -155,9 +155,9 @@ func TestNewSchemaBuilder(t *testing.T) {
155155
}
156156
}
157157

158-
// TestWithCRDCategories_AddsExtension tests the WithCRDCategories method
158+
// TestWithCRDCategories tests the WithCRDCategories method
159159
// for the SchemaBuilder struct. It checks if the categories are correctly added to the schema's extensions.
160-
func TestWithCRDCategories_AddsExtension(t *testing.T) {
160+
func TestWithCRDCategories(t *testing.T) {
161161
tests := []struct {
162162
name string
163163
key string
@@ -218,9 +218,9 @@ func TestWithCRDCategories_AddsExtension(t *testing.T) {
218218
}
219219
}
220220

221-
// TestWithApiResourceCategories_AddsExtension tests the WithApiResourceCategories method
221+
// TestWithApiResourceCategories tests the WithApiResourceCategories method
222222
// for the SchemaBuilder struct. It checks if the categories are correctly added to the schema's extensions.
223-
func TestWithApiResourceCategories_AddsExtension(t *testing.T) {
223+
func TestWithApiResourceCategories(t *testing.T) {
224224
tests := []struct {
225225
name string
226226
key string

0 commit comments

Comments
 (0)