github.com/vchain-us/vcn@v0.9.11-0.20210921212052-a2484d23c0b3/pkg/bundle/descriptor_test.go (about)

     1  /*
     2   * Copyright (c) 2018-2020 vChain, Inc. All Rights Reserved.
     3   * This software is released under GPL3.
     4   * The full license information can be found under:
     5   * https://www.gnu.org/licenses/gpl-3.0.en.html
     6   *
     7   */
     8  
     9  package bundle
    10  
    11  import (
    12  	"strings"
    13  	"testing"
    14  
    15  	// See https://github.com/opencontainers/go-digest#usage
    16  	_ "crypto/sha256"
    17  	_ "crypto/sha512"
    18  
    19  	"github.com/stretchr/testify/assert"
    20  )
    21  
    22  func TestDescriptor(t *testing.T) {
    23  	d, err := NewDescriptor("path", strings.NewReader("qwertyuiopasdfghjklzxcvbnm"))
    24  	assert.NoError(t, err)
    25  	assert.Equal(t, "sha256:8e5eb603482f00768b60cb17f947e273d6aa7c82ffaf8e589a06f6e841c3cef8", d.Digest.String())
    26  	assert.Equal(t, uint64(26), d.Size)
    27  	assert.Equal(t, []string{"path"}, d.Paths)
    28  }