github.com/microsoft/fabrikate@v1.0.0-alpha.1.0.20210115014322-dc09194d0885/internal/generators/static_test.go (about) 1 package generators 2 3 import ( 4 "testing" 5 6 "github.com/microsoft/fabrikate/internal/core" 7 "github.com/stretchr/testify/assert" 8 ) 9 10 func TestStaticGenerator_Generate(t *testing.T) { 11 component := core.Component{ 12 Name: "foo", 13 Path: "", 14 PhysicalPath: "../../testdata/invaliddir", 15 } 16 17 generator := &StaticGenerator{} 18 _, err := generator.Generate(&component) 19 assert.NotNil(t, err) 20 } 21 22 func TestGetStaticComponentPath(t *testing.T) { 23 component := core.Component{ 24 Name: "kv-flexvol", 25 ComponentType: "static", 26 Method: "http", 27 Source: "https://raw.githubusercontent.com/Azure/kubernetes-keyvault-flexvol/master/deployment/kv-flexvol-installer.yaml", 28 } 29 30 expectedComponentPath := "components/kv-flexvol" 31 componentPath, _ := GetStaticManifestsPath(component) 32 33 assert.Equal(t, expectedComponentPath, componentPath) 34 }