Updated model builder to use lowercase checks only. **breaking change**

The case checking seems kinda dumb now looking back at this code. I am not sure why I felt the need to do that, however after being aware of it for some time and not being happy with the extra cycles it puts the code through.

This change removes ConvertCase from the utils package, as it's no longer used or needed right now. If it needs co come back, we can re-add the code, but deleting code always makes me happy.
It also removed a dependency from the project, which reduces the footprint, great!
This commit is contained in:
Dave Shanley
2022-11-05 09:54:34 -04:00
parent 9e0c5cd2e9
commit 77ecbd418f
5 changed files with 3 additions and 56 deletions

View File

@@ -601,24 +601,6 @@ func TestDetectCase(t *testing.T) {
assert.Equal(t, RegularCase, DetectCase("kebab-TimeIn_london-TOWN"))
}
func TestConvertCase(t *testing.T) {
str1 := "chicken-nuggets-chicken-soup"
assert.Equal(t, "chickenNuggetsChickenSoup", ConvertCase(str1, CamelCase))
assert.Equal(t, "ChickenNuggetsChickenSoup", ConvertCase(str1, PascalCase))
assert.Equal(t, "chicken_nuggets_chicken_soup", ConvertCase(str1, SnakeCase))
assert.Equal(t, str1, ConvertCase(str1, KebabCase))
assert.Equal(t, "CHICKEN-NUGGETS-CHICKEN-SOUP", ConvertCase(str1, ScreamingKebabCase))
assert.Equal(t, "CHICKEN_NUGGETS_CHICKEN_SOUP", ConvertCase(str1, ScreamingSnakeCase))
}
func TestConvertCase_NoInput(t *testing.T) {
assert.Empty(t, ConvertCase("", ScreamingKebabCase))
}
func TestDetectCase_NoInput(t *testing.T) {
assert.Equal(t, UnknownCase, DetectCase(""))
}
func TestIsNodeRefValue(t *testing.T) {
f := &yaml.Node{