Skip to content

Commit

Permalink
Added few tests on helpers, utills
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrst88 committed May 9, 2018
1 parent 21b7212 commit c940233
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions generator_test.go
@@ -1 +1,27 @@
package main

import (
"os"
"testing"
)

var mockFile = "mock.tf"

func TestContainsElement(t *testing.T) {
testSlice := []string{"Terraform", "Puppet", "Ansible"}
if containsElement(testSlice, "Chef") {
t.Error("Should return false, but return true")
}
}

func TestGetAllFiles(t *testing.T) {
var file, err = os.Create(mockFile)
checkError(err)
defer file.Close()
files, err := getAllFiles(tfFileExt)
checkError(err)
if len(files) == 0 {
t.Error("Should found at least one file")
}
defer os.Remove(mockFile)
}

0 comments on commit c940233

Please sign in to comment.