Add small prettyKey test
This commit is contained in:
parent
15a0692ac8
commit
c8897d0c78
|
@ -7,6 +7,8 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/pulumi/pulumi/pkg/pack"
|
||||
|
||||
"github.com/pulumi/pulumi/pkg/util/contract"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
@ -80,6 +82,10 @@ func prettyKey(key string) string {
|
|||
return key
|
||||
}
|
||||
|
||||
return prettyKeyForPackage(key, pkg)
|
||||
}
|
||||
|
||||
func prettyKeyForPackage(key string, pkg pack.Package) string {
|
||||
s := key
|
||||
defaultPrefix := fmt.Sprintf("%s:config:", pkg.Name)
|
||||
|
||||
|
|
19
cmd/config_test.go
Normal file
19
cmd/config_test.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/pulumi/pulumi/pkg/pack"
|
||||
"github.com/pulumi/pulumi/pkg/tokens"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestPrettyKeyForPackage(t *testing.T) {
|
||||
pkg := pack.Package{Name: tokens.PackageName("test-package"), Runtime: "nodejs"}
|
||||
|
||||
assert.Equal(t, "foo", prettyKeyForPackage("test-package:config:foo", pkg))
|
||||
assert.Equal(t, "other-package:config:bar", prettyKeyForPackage("other-package:config:bar", pkg))
|
||||
}
|
Loading…
Reference in a new issue