-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package libp2p | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/libp2p/go-libp2p/core/event" | ||
"github.com/libp2p/go-libp2p/core/host" | ||
"github.com/libp2p/go-libp2p/core/peer" | ||
"github.com/stretchr/testify/require" | ||
"go.uber.org/fx" | ||
) | ||
|
||
func TestGetPeerID(t *testing.T) { | ||
var id peer.ID | ||
host, err := New( | ||
WithFxOption(fx.Populate(&id)), | ||
) | ||
require.NoError(t, err) | ||
defer host.Close() | ||
|
||
require.Equal(t, host.ID(), id) | ||
|
||
} | ||
|
||
func TestGetEventBus(t *testing.T) { | ||
var eb event.Bus | ||
host, err := New( | ||
NoTransports, | ||
WithFxOption(fx.Populate(&eb)), | ||
) | ||
require.NoError(t, err) | ||
defer host.Close() | ||
|
||
require.NotNil(t, eb) | ||
} | ||
|
||
func TestGetHost(t *testing.T) { | ||
var h host.Host | ||
host, err := New( | ||
NoTransports, | ||
WithFxOption(fx.Populate(&h)), | ||
) | ||
require.NoError(t, err) | ||
defer host.Close() | ||
|
||
require.NotNil(t, h) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters