5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-05 02:22:11 +08:00
wails/v3/internal/templates/templates_test.go
2023-09-08 14:37:07 +10:00

39 lines
745 B
Go

package templates
import (
"os"
"testing"
"github.com/wailsapp/wails/v3/internal/flags"
)
func TestInstall(t *testing.T) {
tests := []struct {
name string
options *flags.Init
wantErr bool
}{
{
name: "should install template",
options: &flags.Init{
ProjectName: "test",
TemplateName: "svelte",
Quiet: false,
},
wantErr: false,
},
}
for _, tt := range tests {
// Remove test directory if it exists
if _, err := os.Stat(tt.options.ProjectName); err == nil {
_ = os.RemoveAll(tt.options.ProjectName)
}
t.Run(tt.name, func(t *testing.T) {
if err := Install(tt.options); (err != nil) != tt.wantErr {
t.Errorf("Install() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}