2019-01-22 01:56:16 -02:00
|
|
|
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))
|
|
|
|
})
|
|
|
|
|
2021-04-19 09:31:57 -03:00
|
|
|
t.Run("pipe expected skipped", func(t *testing.T) {
|
|
|
|
require.NoError(t, ErrHandler(mockAction(pipe.ErrSkipDisabledPipe))(ctx))
|
|
|
|
})
|
|
|
|
|
2019-01-22 01:56:16 -02:00
|
|
|
t.Run("some err", func(t *testing.T) {
|
|
|
|
require.Error(t, ErrHandler(mockAction(fmt.Errorf("pipe errored")))(ctx))
|
|
|
|
})
|
|
|
|
}
|