Skip to content

Commit

Permalink
test: initial Create test
Browse files Browse the repository at this point in the history
Signed-off-by: William Casarin <jb55@jb55.com>
  • Loading branch information
jb55 committed Oct 11, 2019
1 parent aee97da commit 4dc4219
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/create_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package main

import (
"github.com/commitdev/commit0/cmd"
"io/ioutil"
"os"
"path"
"testing"
)

func TestInitWorks(t *testing.T) {
cmd.Init()
}

func TestCreateWorks(t *testing.T) {
tmpdir, err := ioutil.TempDir("", "commit0-")
if err != nil {
t.Fatal(err)
}

projectName := "test-project"

root := cmd.Create(projectName, tmpdir)
defer os.RemoveAll(tmpdir)

st, err := os.Stat(path.Join(root, "commit0.yml"))
if err != nil {
t.Fatal(err)
}

if st.Size() == 0 {
t.Fatalf("commit0.yml is empty")
}
}

0 comments on commit 4dc4219

Please sign in to comment.