github.com/theliebeskind/genfig@v0.1.5-alpha/writers/plugins_test.go (about)

     1  package writers_test
     2  
     3  import (
     4  	"io/ioutil"
     5  	"os"
     6  	"testing"
     7  
     8  	"github.com/stretchr/testify/assert"
     9  	"github.com/theliebeskind/genfig/models"
    10  	"github.com/theliebeskind/genfig/plugins"
    11  	"github.com/theliebeskind/genfig/writers"
    12  )
    13  
    14  func Test_WritePlugins(t *testing.T) {
    15  	sm := models.SchemaMap{}
    16  	calls := map[string]string{}
    17  	dir, _ := ioutil.TempDir("", "genfig")
    18  	defer os.RemoveAll(dir)
    19  	files, err := writers.WritePlugins(sm, dir, "test", "genfig test", calls)
    20  	assert.NoError(t, err)
    21  	assert.Len(t, files, len(plugins.Plugins))
    22  	for _, f := range files {
    23  		assert.FileExists(t, f)
    24  	}
    25  }