1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-31 01:53:50 +02:00

test: improve some tests

This commit is contained in:
Carlos Alexandro Becker 2023-11-03 23:33:31 +00:00
parent 0fbc447fe1
commit 422c46daff
3 changed files with 23 additions and 5 deletions

View File

@ -1102,9 +1102,17 @@ func TestWrapInDirectory(t *testing.T) {
func TestSkip(t *testing.T) {
t.Run("skip", func(t *testing.T) {
require.True(t, Pipe{}.Skip(testctx.New()))
require.True(t, Pipe{}.Skip(testctx.New(testctx.Skip(skips.Scoop))))
})
t.Run("skip flag", func(t *testing.T) {
ctx := testctx.NewWithCfg(config.Project{
Scoop: config.Scoop{
Repository: config.RepoRef{
Name: "a",
},
},
}, testctx.Skip(skips.Scoop))
require.False(t, Pipe{}.Skip(ctx))
})
t.Run("dont skip", func(t *testing.T) {
ctx := testctx.NewWithCfg(config.Project{
Scoop: config.Scoop{

View File

@ -679,9 +679,15 @@ func Test_isValidArch(t *testing.T) {
func TestSkip(t *testing.T) {
t.Run("skip", func(t *testing.T) {
require.True(t, Pipe{}.Skip(testctx.New()))
require.True(t, Pipe{}.Skip(testctx.New(testctx.Skip(skips.Snapcraft))))
})
t.Run("skip flag", func(t *testing.T) {
ctx := testctx.NewWithCfg(config.Project{
Snapcrafts: []config.Snapcraft{
{},
},
}, testctx.Skip(skips.Snapcraft))
require.False(t, Pipe{}.Skip(ctx))
})
t.Run("dont skip", func(t *testing.T) {
ctx := testctx.NewWithCfg(config.Project{
Snapcrafts: []config.Snapcraft{

View File

@ -28,7 +28,11 @@ func TestString(t *testing.T) {
func TestSkip(t *testing.T) {
t.Run("should", func(t *testing.T) {
require.True(t, Pipe{}.Skip(testctx.New()))
require.True(t, Pipe{}.Skip(testctx.New(testctx.Skip(skips.Winget))))
})
t.Run("skip flag", func(t *testing.T) {
require.False(t, Pipe{}.Skip(testctx.NewWithCfg(config.Project{
Winget: []config.Winget{{}},
}, testctx.Skip(skips.Winget))))
})
t.Run("should not", func(t *testing.T) {
require.False(t, Pipe{}.Skip(testctx.NewWithCfg(config.Project{