refactor: move common io-related functions into new file
This commit is contained in:
committed by
Jose Diaz-Gonzalez
parent
696df45306
commit
33d3722060
28
plugins/common/io_test.go
Normal file
28
plugins/common/io_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestCommonFileToSlice(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
Expect(setupTestApp()).To(Succeed())
|
||||
lines, err := FileToSlice(testEnvFile)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(lines).To(Equal([]string{testEnvLine}))
|
||||
teardownTestApp()
|
||||
}
|
||||
|
||||
func TestCommonFileExists(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
Expect(setupTestApp()).To(Succeed())
|
||||
Expect(FileExists(testEnvFile)).To(BeTrue())
|
||||
teardownTestApp()
|
||||
}
|
||||
|
||||
func TestCommonReadFirstLine(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
line := ReadFirstLine(testEnvFile)
|
||||
Expect(line).To(Equal(""))
|
||||
Expect(setupTestApp()).To(Succeed())
|
||||
line = ReadFirstLine(testEnvFile)
|
||||
Expect(line).To(Equal(testEnvLine))
|
||||
teardownTestApp()
|
||||
}
|
||||
Reference in New Issue
Block a user