feat: test coverage more than 85%

This commit is contained in:
2023-03-05 00:05:00 +01:00
parent 89136cae59
commit 0bf7b63286
3 changed files with 106 additions and 0 deletions

View File

@@ -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,
}