private/version: document kebabToPascal

Change-Id: Id7bdf969072c330956c093c24b662f4330fc4d4c
This commit is contained in:
Egon Elbre 2022-03-31 13:52:27 +03:00
parent 5fca07387f
commit 7aa001d62f
2 changed files with 21 additions and 0 deletions

View File

@ -126,6 +126,7 @@ func (client *Client) Process(ctx context.Context, processName string) (process
return process, nil
}
// kebabToPascal converts `alpha-beta` to `AlphaBeta`.
func kebabToPascal(str string) string {
return strings.ReplaceAll(cases.Title(language.Und, cases.NoLower).String(str), "-", "")
}

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.
package checker
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestKebabToPascal(t *testing.T) {
require.Equal(t, "StoragenodeUpdater", kebabToPascal("StoragenodeUpdater"))
require.Equal(t, "StoragenodeUpdater", kebabToPascal("storagenode-updater"))
require.Equal(t, "Satellite", kebabToPascal("satellite"))
require.Equal(t, "Storagenode", kebabToPascal("storagenode"))
require.Equal(t, "Uplink", kebabToPascal("uplink"))
require.Equal(t, "Gateway", kebabToPascal("gateway"))
require.Equal(t, "Identity", kebabToPascal("identity"))
}