5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 01:13:03 +08:00
wails/v2/pkg/templates/templates_test.go
Lea Anthony b93cdcd942
Releasetest/release workflow (#1869)
* Test release workflow

* Update release.yml

* Update release.yml

* add linux deps

* Update release.yml

* Update release.yml

* Update release.yml

* Update release.yml

* Update release.yml

* Update release.yml

* Update release.yml

* Update release.yml

* Update release.yml

* Fix: Misc tests

* Fix: Misc tests + linux build tags

* Fix: Bindings tests + move templates to pkg. Add json schema for templates

* Fix: template tests

* Add tests to release workflow. Test for go 1.18 + go 1.19
Fix: ignore .m files for non darwin builds. Fix watcher test. Fix warning in clilogger.

* Fix release pipeline

* Matrix for tests

* Rename templates to make tests work

* Update template test

* Debug template test

* Debug template test

* Debug template test

* Fix gitignore

* Update release.yml
2022-09-18 08:55:21 +10:00

55 lines
871 B
Go

package templates
import (
"os"
"path/filepath"
"runtime"
"testing"
"github.com/matryer/is"
)
func TestList(t *testing.T) {
is2 := is.New(t)
templateList, err := List()
is2.NoErr(err)
is2.Equal(len(templateList), 13)
}
func TestShortname(t *testing.T) {
is2 := is.New(t)
vanillaTemplate, err := getTemplateByShortname("vanilla")
is2.NoErr(err)
is2.Equal(vanillaTemplate.Name, "Vanilla + Vite")
}
func TestInstall(t *testing.T) {
is2 := is.New(t)
// Change to the directory of this file
_, filename, _, _ := runtime.Caller(0)
err := os.Chdir(filepath.Dir(filename))
is2.NoErr(err)
options := &Options{
ProjectName: "test",
TemplateName: "vanilla",
AuthorName: "Lea Anthony",
AuthorEmail: "lea.anthony@gmail.com",
}
defer func() {
_ = os.RemoveAll(options.ProjectName)
}()
_, _, err = Install(options)
is2.NoErr(err)
}