github.com/joselitofilho/goreleaser@v0.155.1-0.20210123221854-e4891856c593/internal/middleware/error_test.go (about)

     1  package middleware
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/goreleaser/goreleaser/internal/pipe"
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  func TestError(t *testing.T) {
    12  	t.Run("no errors", func(t *testing.T) {
    13  		require.NoError(t, ErrHandler(mockAction(nil))(ctx))
    14  	})
    15  
    16  	t.Run("pipe skipped", func(t *testing.T) {
    17  		require.NoError(t, ErrHandler(mockAction(pipe.ErrSkipValidateEnabled))(ctx))
    18  	})
    19  
    20  	t.Run("some err", func(t *testing.T) {
    21  		require.Error(t, ErrHandler(mockAction(fmt.Errorf("pipe errored")))(ctx))
    22  	})
    23  }