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

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package didexchange
     8  
     9  import (
    10  	"errors"
    11  	"testing"
    12  
    13  	"github.com/stretchr/testify/require"
    14  )
    15  
    16  func TestDIDExchangeEvent(t *testing.T) {
    17  	ev := didExchangeEvent{connectionID: "abc", invitationID: "xyz"}
    18  	require.Equal(t, ev.ConnectionID(), "abc")
    19  	require.Equal(t, ev.InvitationID(), "xyz")
    20  	require.Equal(t, ev.All()["connectionID"], ev.ConnectionID())
    21  	require.Equal(t, ev.All()["invitationID"], ev.InvitationID())
    22  
    23  	err := errors.New("processing error")
    24  	evErr := didExchangeEventError{err: err}
    25  	require.Equal(t, err.Error(), evErr.Error())
    26  	require.Equal(t, evErr.All()["error"], evErr.Error())
    27  
    28  	evErr = didExchangeEventError{}
    29  	require.Equal(t, "", evErr.Error())
    30  }