github.com/hyperledger/aries-framework-go@v0.3.2/pkg/didcomm/protocol/issuecredential/properties_test.go (about)

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package issuecredential
     8  
     9  import (
    10  	"errors"
    11  	"testing"
    12  
    13  	"github.com/stretchr/testify/require"
    14  )
    15  
    16  func TestEventProps_All(t *testing.T) {
    17  	md := &MetaData{}
    18  	md.MyDID = "MyDID"
    19  	md.TheirDID = "TheirDID"
    20  	md.PIID = "PIID"
    21  	md.err = errors.New("error")
    22  
    23  	props := newEventProps(md)
    24  
    25  	require.Equal(t, md.MyDID, props.MyDID())
    26  	require.Equal(t, md.TheirDID, props.TheirDID())
    27  	require.Equal(t, md.PIID, props.PIID())
    28  	require.Equal(t, md.err, props.Err())
    29  	require.Equal(t, 4, len(props.All()))
    30  
    31  	md.err = customError{errors.New("error")}
    32  	md.MyDID = ""
    33  
    34  	props = newEventProps(md)
    35  
    36  	require.Equal(t, md.MyDID, props.MyDID())
    37  	require.Equal(t, md.TheirDID, props.TheirDID())
    38  	require.Equal(t, md.PIID, props.PIID())
    39  	require.Equal(t, nil, props.Err())
    40  	require.Equal(t, 2, len(props.All()))
    41  }