Skip to content

Commit c940233

Browse files
committed
Added few tests on helpers, utills
1 parent 21b7212 commit c940233

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

generator_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
11
package main
2+
3+
import (
4+
"os"
5+
"testing"
6+
)
7+
8+
var mockFile = "mock.tf"
9+
10+
func TestContainsElement(t *testing.T) {
11+
testSlice := []string{"Terraform", "Puppet", "Ansible"}
12+
if containsElement(testSlice, "Chef") {
13+
t.Error("Should return false, but return true")
14+
}
15+
}
16+
17+
func TestGetAllFiles(t *testing.T) {
18+
var file, err = os.Create(mockFile)
19+
checkError(err)
20+
defer file.Close()
21+
files, err := getAllFiles(tfFileExt)
22+
checkError(err)
23+
if len(files) == 0 {
24+
t.Error("Should found at least one file")
25+
}
26+
defer os.Remove(mockFile)
27+
}

0 commit comments

Comments
 (0)