few tests
This commit is contained in:
parent
3f502dba81
commit
d21afa5f6d
1 changed files with 31 additions and 0 deletions
31
framework/config/project_test.go
Normal file
31
framework/config/project_test.go
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
package config
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestDefaultProjectConfig(t *testing.T) {
|
||||||
|
cfg := DefaultProjectConfig()
|
||||||
|
assert.Equal(t, true, cfg.Tailwind)
|
||||||
|
assert.Equal(t, 4, len(cfg.WatchIgnore))
|
||||||
|
assert.Equal(t, 8, len(cfg.WatchFiles))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNoConfigFileUsesDefault(t *testing.T) {
|
||||||
|
cfg := FromConfigFile("testdata")
|
||||||
|
assert.Equal(t, true, cfg.Tailwind)
|
||||||
|
assert.Equal(t, 4, len(cfg.WatchIgnore))
|
||||||
|
assert.Equal(t, 8, len(cfg.WatchFiles))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPartialConfigMerges(t *testing.T) {
|
||||||
|
os.Mkdir("testdata", 0755)
|
||||||
|
defer os.RemoveAll("testdata")
|
||||||
|
os.WriteFile("testdata/htmgo.yaml", []byte("tailwind: false"), 0644)
|
||||||
|
cfg := FromConfigFile("testdata")
|
||||||
|
assert.Equal(t, false, cfg.Tailwind)
|
||||||
|
assert.Equal(t, 4, len(cfg.WatchIgnore))
|
||||||
|
assert.Equal(t, 8, len(cfg.WatchFiles))
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue