mukan-ignite/ignite/pkg/xstrcase/xstrcase_test.go
Mukan Erkin Törük 26b204bd04
Some checks are pending
Docs Deploy / build_and_deploy (push) Waiting to run
Generate Docs / cli (push) Waiting to run
Generate Config Doc / cli (push) Waiting to run
Go formatting / go-formatting (push) Waiting to run
Check links / markdown-link-check (push) Waiting to run
Integration / pre-test (push) Waiting to run
Integration / test on (push) Blocked by required conditions
Integration / status (push) Blocked by required conditions
Lint / Lint Go code (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
feat: fork Ignite CLI v29 as Mukan Ignite — remove cosmos-sdk restrictions
2026-05-11 03:31:37 +03:00

112 lines
1.8 KiB
Go

package xstrcase
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestLowercase(t *testing.T) {
tests := []struct {
name string
arg string
want string
}{
{
name: "simple lowercase",
arg: "Example-Test",
want: "exampletest",
},
{
name: "already lowercase",
arg: "example_test",
want: "exampletest",
},
{
name: "mixed case with dash",
arg: "Mixed-Case_String",
want: "mixedcasestring",
},
{
name: "uppercase input",
arg: "UPPER-CASE",
want: "uppercase",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := Lowercase(tt.arg)
require.Equal(t, tt.want, got)
})
}
}
func TestUpperCamel(t *testing.T) {
tests := []struct {
name string
arg string
want string
}{
{
name: "simple camel case",
arg: "example_test",
want: "ExampleTest",
},
{
name: "mixed case with dash",
arg: "Mixed-Case_String",
want: "MixedCaseString",
},
{
name: "uppercase input",
arg: "UPPER_CASE",
want: "UpperCase",
},
{
name: "lowercase input",
arg: "lower_case",
want: "LowerCase",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := UpperCamel(tt.arg)
require.Equal(t, tt.want, got)
})
}
}
func TestUppercase(t *testing.T) {
tests := []struct {
name string
arg string
want string
}{
{
name: "simple uppercase",
arg: "example-test",
want: "EXAMPLETEST",
},
{
name: "already uppercase",
arg: "EXAMPLE_TEST",
want: "EXAMPLETEST",
},
{
name: "mixed case input",
arg: "Mixed-Case_String",
want: "MIXEDCASESTRING",
},
{
name: "lowercase input",
arg: "lower-case",
want: "LOWERCASE",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := Uppercase(tt.arg)
require.Equal(t, tt.want, got)
})
}
}