github.com/rribou/wails/v2@v2.6.3/pkg/templates/templates_test.go (about) 1 package templates 2 3 import ( 4 "os" 5 "path/filepath" 6 "runtime" 7 "testing" 8 9 "github.com/matryer/is" 10 ) 11 12 func TestList(t *testing.T) { 13 14 is2 := is.New(t) 15 templateList, err := List() 16 is2.NoErr(err) 17 18 is2.Equal(len(templateList), 13) 19 } 20 21 func TestShortname(t *testing.T) { 22 23 is2 := is.New(t) 24 25 vanillaTemplate, err := getTemplateByShortname("vanilla") 26 is2.NoErr(err) 27 28 is2.Equal(vanillaTemplate.Name, "Vanilla + Vite") 29 } 30 31 func TestInstall(t *testing.T) { 32 33 is2 := is.New(t) 34 35 // Change to the directory of this file 36 _, filename, _, _ := runtime.Caller(0) 37 38 err := os.Chdir(filepath.Dir(filename)) 39 is2.NoErr(err) 40 41 options := &Options{ 42 ProjectName: "test", 43 TemplateName: "vanilla", 44 AuthorName: "Lea Anthony", 45 AuthorEmail: "lea.anthony@gmail.com", 46 } 47 48 defer func() { 49 _ = os.RemoveAll(options.ProjectName) 50 }() 51 _, _, err = Install(options) 52 is2.NoErr(err) 53 54 }