github.com/jaylevin/jenkins-library@v1.230.4/pkg/piperenv/artifact_test.go (about)

     1  package piperenv
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  	"github.com/stretchr/testify/require"
     8  )
     9  
    10  func Test_Artifacts_FindByName(t *testing.T) {
    11  	artifacts := Artifacts([]Artifact{{
    12  		Name: "a.jar",
    13  	}})
    14  
    15  	assert.Len(t, artifacts.FindByName("garbage"), 0)
    16  	filtered := artifacts.FindByName("a.jar")
    17  	require.Len(t, filtered, 1)
    18  	assert.Equal(t, "a.jar", filtered[0].Name)
    19  }