diff --git a/core/migration_generator_test.go b/core/migration_generator_test.go index 6bc1d29..8ff5a6a 100644 --- a/core/migration_generator_test.go +++ b/core/migration_generator_test.go @@ -1,11 +1,15 @@ package core import ( + "fmt" "io/ioutil" "log" + "math/rand" "os" "path" "strings" + "testing" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" @@ -20,6 +24,15 @@ func (s *MigrationGeneratorSuite) SetupSuite() { s.command = &NewMigrationCommand{Directory: "/tmp"} } +func (s *MigrationGeneratorSuite) Test_FileExists() { + var ( + seededRand *rand.Rand = rand.New(rand.NewSource(time.Now().UnixNano())) + notExist = fmt.Sprintf("/tmp/%d", seededRand.Int31()) + ) + + assert.False(s.T(), s.command.FileExists(notExist)) +} + func (s *MigrationGeneratorSuite) Test_Execute() { found := false assert.NoError(s.T(), s.command.Execute([]string{})) @@ -37,3 +50,7 @@ func (s *MigrationGeneratorSuite) Test_Execute() { assert.True(s.T(), found) } + +func Test_MigrationGenerator(t *testing.T) { + suite.Run(t, new(MigrationGeneratorSuite)) +}