github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/nodejs/gen_program_test.go (about) 1 package nodejs 2 3 import ( 4 "testing" 5 6 "github.com/pulumi/pulumi/pkg/v3/codegen" 7 "github.com/pulumi/pulumi/pkg/v3/codegen/testing/test" 8 ) 9 10 func TestGenerateProgramVersionSelection(t *testing.T) { 11 t.Parallel() 12 13 expectedVersion := map[string]test.PkgVersionInfo{ 14 "aws-resource-options-4.26": { 15 Pkg: "\"@pulumi/aws\"", 16 OpAndVersion: "\"4.26.0\"", 17 }, 18 "aws-resource-options-5.16.2": { 19 Pkg: "\"@pulumi/aws\"", 20 OpAndVersion: "\"5.16.2\"", 21 }, 22 } 23 24 test.TestProgramCodegen(t, 25 test.ProgramCodegenOptions{ 26 Language: "nodejs", 27 Extension: "ts", 28 OutputFile: "index.ts", 29 Check: func(t *testing.T, path string, dependencies codegen.StringSet) { 30 Check(t, path, dependencies, true) 31 }, 32 GenProgram: GenerateProgram, 33 TestCases: []test.ProgramTest{ 34 { 35 Directory: "aws-resource-options-4.26", 36 Description: "Resource Options", 37 }, 38 { 39 Directory: "aws-resource-options-5.16.2", 40 Description: "Resource Options", 41 }, 42 }, 43 44 IsGenProject: true, 45 GenProject: GenerateProject, 46 ExpectedVersion: expectedVersion, 47 DependencyFile: "package.json", 48 }) 49 }