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

     1  /*
     2  Copyright Avast Software. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package legacyconnection
     8  
     9  import (
    10  	"errors"
    11  	"testing"
    12  
    13  	"github.com/stretchr/testify/require"
    14  )
    15  
    16  func TestConnectionEvent(t *testing.T) {
    17  	ev := connectionEvent{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 := connectionEventError{err: err}
    25  	require.Equal(t, err.Error(), evErr.Error())
    26  	require.Equal(t, evErr.All()["error"], evErr.Error())
    27  
    28  	evErr = connectionEventError{}
    29  	require.Equal(t, "", evErr.Error())
    30  }