Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/sts v1.19.3
github.com/aws/smithy-go v1.13.5
github.com/getsentry/sentry-go v0.22.0
github.com/iancoleman/strcase v0.2.0
github.com/iancoleman/strcase v0.3.0
github.com/nats-io/jwt/v2 v2.4.1
github.com/nats-io/nkeys v0.4.4
github.com/overmindtech/connect v0.11.4
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
Expand Down
11 changes: 8 additions & 3 deletions sources/case_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import (
)

func TestCamelCase(t *testing.T) {
t.Parallel()

exampleMap := make(map[string]interface{})

exampleMap["Name"] = "Dylan"
exampleMap["Nested"] = map[string]interface{}{
"NestedKeyName": "Value",
"NestedAWSAcronym": "Wow",
"NestedKeyName": "Value",
"NestedAWSAcronym": "Wow",
"DBClusterParameterGroupName": "foo",
"NestedArray": []map[string]string{
{
"FooBar": "Baz",
Expand All @@ -25,14 +28,16 @@ func TestCamelCase(t *testing.T) {

b, _ := json.Marshal(camel)

expected := `{"name":"Dylan","nested":{"nestedAWSAcronym":"Wow","nestedArray":[{"fooBar":"Baz"}],"nestedKeyName":"Value"}}`
expected := `{"name":"Dylan","nested":{"dBClusterParameterGroupName":"foo","nestedAWSAcronym":"Wow","nestedArray":[{"fooBar":"Baz"}],"nestedKeyName":"Value"}}`

if string(b) != expected {
t.Fatalf("expected %v got %v", expected, string(b))
}
}

func TestToAttributesCase(t *testing.T) {
t.Parallel()

exampleMap := make(map[string]interface{})

exampleMap["Name"] = "Dylan"
Expand Down