feat: test coverage more than 85%
This commit is contained in:
@@ -11,7 +11,13 @@ type writer struct {
|
||||
dirPath string
|
||||
}
|
||||
|
||||
// WriteFile writes file into `w writer` directory.
|
||||
// Returns outputPath and error
|
||||
func (w writer) WriteFile(filename string, data []byte) (string, error) {
|
||||
if filename == "" {
|
||||
return "", fmt.Errorf("filename cannot be empty")
|
||||
}
|
||||
|
||||
if w.dirPath == "" {
|
||||
return "", fmt.Errorf("export directory cannot be empty")
|
||||
}
|
||||
@@ -27,6 +33,10 @@ func (w writer) WriteFile(filename string, data []byte) (string, error) {
|
||||
}
|
||||
|
||||
func NewWriter(dirPath string) io.WriterIface {
|
||||
return newWriter(dirPath)
|
||||
}
|
||||
|
||||
func newWriter(dirPath string) *writer {
|
||||
return &writer{
|
||||
dirPath: dirPath,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user