Add tests

This commit is contained in:
Marly Puckett 2023-02-11 15:10:56 -08:00
parent bab2c18c24
commit 5dca1be016

View File

@ -48,6 +48,20 @@ func TestSplitAndParseResourceRequest(t *testing.T) {
expectedGVR: schema.GroupVersionResource{Resource: "services", Version: "v1"},
expectedFieldsPath: []string{"field2", "field3"},
},
{
name: "field with dots 1",
inResource: `service.field2['field\.with\.dots']`,
expectedGVR: schema.GroupVersionResource{Resource: "services", Version: "v1"},
expectedFieldsPath: []string{"field2", "field.with.dots"},
},
{
name: "field with dots 2",
inResource: `service.field2.field\.with\.dots`,
expectedGVR: schema.GroupVersionResource{Resource: "services", Version: "v1"},
expectedFieldsPath: []string{"field2", "field.with.dots"},
},
{
name: "trailing period with incorrect fieldsPath",
inResource: "node.field2.field3.",