2020-10-08 03:13:10 +02:00
|
|
|
// nolint: lll
|
2020-09-25 21:35:27 +02:00
|
|
|
package nodejs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2021-03-17 14:20:05 +01:00
|
|
|
"github.com/pulumi/pulumi/pkg/v3/codegen/internal/test"
|
2021-07-09 19:23:10 +02:00
|
|
|
"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
|
|
|
|
"github.com/stretchr/testify/require"
|
2020-09-25 21:35:27 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestGeneratePackage(t *testing.T) {
|
2021-07-07 00:40:53 +02:00
|
|
|
test.TestSDKCodegen(t, "nodejs", GeneratePackage)
|
2020-09-25 21:35:27 +02:00
|
|
|
}
|
2021-07-09 19:23:10 +02:00
|
|
|
|
|
|
|
func TestGenerateTypeNames(t *testing.T) {
|
|
|
|
test.TestTypeNameCodegen(t, "nodejs", func(pkg *schema.Package) test.TypeNameGeneratorFunc {
|
|
|
|
// Decode node-specific info
|
|
|
|
err := pkg.ImportLanguages(map[string]schema.Language{"nodejs": Importer})
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
info, _ := pkg.Language["nodejs"].(NodePackageInfo)
|
|
|
|
|
|
|
|
modules, info, err := generateModuleContextMap("test", pkg, info, nil)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
pkg.Language["nodejs"] = info
|
|
|
|
|
|
|
|
root, ok := modules[""]
|
|
|
|
require.True(t, ok)
|
|
|
|
|
|
|
|
return func(t schema.Type) string {
|
|
|
|
return root.typeString(t, false, nil)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|