Skip to content

Commit

Permalink
chore(config/env): polish watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyang2 committed Aug 16, 2021
1 parent a9f8892 commit 451bb79
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions config/env/watcher_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package env

import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func Test_watcher_next(t *testing.T) {
t.Run("next after stop should return err", func(t *testing.T) {
w, err := NewWatcher()
require.NoError(t, err)

_ = w.Stop()
_, err = w.Next()
assert.Error(t, err)
})
}

func Test_watcher_stop(t *testing.T) {
t.Run("stop multiple times should not panic", func(t *testing.T) {
w, err := NewWatcher()
require.NoError(t, err)

_ = w.Stop()
_ = w.Stop()
})
}

0 comments on commit 451bb79

Please sign in to comment.