get.porter.sh/porter@v1.3.0/pkg/cache/cached_bundle_test.go (about)

     1  package cache
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestCachedBundle_GetBundleID(t *testing.T) {
    10  	t.Parallel()
    11  
    12  	cb := CachedBundle{}
    13  
    14  	cb.Reference = kahn1dot01
    15  	bid := cb.GetBundleID()
    16  	assert.Equal(t, kahn1dot0Hash, bid, "hashing the bundle ID twice should be the same")
    17  
    18  	cb.Reference = kahnlatest
    19  	bid2 := cb.GetBundleID()
    20  	assert.NotEqual(t, kahn1dot0Hash, bid2, "different tags should result in different hashes")
    21  }