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
Describe the bug
The CamelCase method in the package is currently not handling PascalCase and camelCase strings correctly. Specifically, the method converts both lower case of the input when the input is written in PascalCase or CamelCase.
To Reproduce
Use the CamelCase method with the input TestEntity.
Use the CamelCase method with the input testEntity.
Observe that both inputs are converted to testentity.
Expected behavior TestEntity should be converted to testEntity. testEntity should remain testEntity.
Additional context
you can run this test
func TestCamelCaseHelper(t *testing.T) {
tests := []struct {
input string
expected string
} {
{"test", "test"},
{"test entity", "testEntity"},
{"test-entity", "testEntity"},
{"test-entity_test", "testEntityTest"},
{"test_entity", "testEntity"},
{"TestEntity", "testEntity"},
{"testEntity", "testEntity"},
{"test_entity_definition", "testEntityDefinition"},
}
for _, test := range tests {
actual := stringy.New(test.input).CamelCase().Get()
if actual != test.expected {
t.Errorf("Expected %s, got %s, input: %s", test.expected, actual, test.input)
}
}
}
The text was updated successfully, but these errors were encountered:
Describe the bug
The CamelCase method in the package is currently not handling PascalCase and camelCase strings correctly. Specifically, the method converts both lower case of the input when the input is written in PascalCase or CamelCase.
To Reproduce
CamelCase
method with the inputTestEntity
.CamelCase
method with the inputtestEntity
.testentity
.Expected behavior
TestEntity
should be converted totestEntity
.testEntity
should remaintestEntity
.Additional context
you can run this test
The text was updated successfully, but these errors were encountered: