1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/internal/middleware/error_test.go
Carlos Alexandro Becker 60e54a1368
refactor/fix: improved CLI (#937)
* refactor: added middleware for action logs/error handling

* refactor: moved custom changelog load from main.go

* fix/refactor: CLI improvements

* test: do not pollute ./dist
2019-01-22 01:56:16 -02:00

24 lines
522 B
Go

package middleware
import (
"fmt"
"testing"
"github.com/goreleaser/goreleaser/internal/pipe"
"github.com/stretchr/testify/require"
)
func TestError(t *testing.T) {
t.Run("no errors", func(t *testing.T) {
require.NoError(t, ErrHandler(mockAction(nil))(ctx))
})
t.Run("pipe skipped", func(t *testing.T) {
require.NoError(t, ErrHandler(mockAction(pipe.ErrSkipValidateEnabled))(ctx))
})
t.Run("some err", func(t *testing.T) {
require.Error(t, ErrHandler(mockAction(fmt.Errorf("pipe errored")))(ctx))
})
}