feat: complete tests

This commit is contained in:
2023-02-26 16:59:20 +01:00
parent 49a72dc34b
commit 16b0a31dd4
5 changed files with 62 additions and 15 deletions

View File

@@ -13,13 +13,23 @@ type watcher struct {
deploy pkgwatcher.DeployFunc
}
type notifier struct{}
func (n *notifier) NewWatcher() (*fsnotify.Watcher, error) {
return fsnotify.NewWatcher()
}
func NewNotifier() *notifier {
return &notifier{}
}
var (
errEventsClosedChan = errors.New("events is closed")
errErrorsClosedChan = errors.New("errors is closed")
)
func NewWatcher(deploy pkgwatcher.DeployFunc) *watcher {
wt, err := fsnotify.NewWatcher()
func NewWatcher(notifier pkgwatcher.NotifyIface, deploy pkgwatcher.DeployFunc) *watcher {
wt, err := notifier.NewWatcher()
if err != nil {
log.Printf("fsnotify.NewWatcher: %s\n", err)
return nil