github.com/goreleaser/goreleaser@v1.25.1/internal/pipe/custompublishers/custompublishers_test.go (about)

     1  package custompublishers
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/goreleaser/goreleaser/internal/testctx"
     7  	"github.com/goreleaser/goreleaser/pkg/config"
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  func TestDescription(t *testing.T) {
    12  	require.NotEmpty(t, Pipe{}.String())
    13  }
    14  
    15  func TestSkip(t *testing.T) {
    16  	t.Run("skip", func(t *testing.T) {
    17  		require.True(t, Pipe{}.Skip(testctx.New()))
    18  	})
    19  
    20  	t.Run("dont skip", func(t *testing.T) {
    21  		ctx := testctx.NewWithCfg(config.Project{
    22  			Publishers: []config.Publisher{
    23  				{},
    24  			},
    25  		})
    26  		require.False(t, Pipe{}.Skip(ctx))
    27  	})
    28  }
    29  
    30  func TestPublish(t *testing.T) {
    31  	require.NoError(t, Pipe{}.Publish(testctx.NewWithCfg(config.Project{
    32  		Publishers: []config.Publisher{
    33  			{
    34  				Cmd: "echo",
    35  			},
    36  		},
    37  	})))
    38  }