diff --git a/cmd/single.go b/cmd/single.go index e9fbc5dcaeeb02060054e709956e7a55109ceeb4..e3c2ad639a5b7b0cd160d29023f06a407f0c2b61 100644 --- a/cmd/single.go +++ b/cmd/single.go @@ -72,7 +72,7 @@ var singleCmd = &cobra.Command{ waitUntilConnected(connected) // Make single-use manager and start receiving process - singleMng := single.NewManager(client, client.GetStorage().Reception()) + singleMng := single.NewManager(client) // Register the callback callbackChan := make(chan responseCallbackChan) diff --git a/single/manager.go b/single/manager.go index d24c88fdd684271262da556d746220d9dc9d914f..cbf21d9524799129d96139c727a3371b54592f16 100644 --- a/single/manager.go +++ b/single/manager.go @@ -50,7 +50,11 @@ type Manager struct { } // NewManager creates a new single-use communication manager. -func NewManager(client *api.Client, reception *reception.Store) *Manager { +func NewManager(client *api.Client) *Manager { + return newManager(client, client.GetStorage().Reception()) +} + +func newManager(client *api.Client, reception *reception.Store) *Manager { return &Manager{ client: client, store: client.GetStorage(), diff --git a/single/manager_test.go b/single/manager_test.go index c7f94b1010116b43f290c51de1dcdf9e4cdc7a77..d2dcfa4beae708c435532589f5dc42497b682f77 100644 --- a/single/manager_test.go +++ b/single/manager_test.go @@ -39,13 +39,13 @@ import ( ) // Happy path. -func TestNewManager(t *testing.T) { +func Test_newManager(t *testing.T) { client := &api.Client{} e := &Manager{ client: client, p: newPending(), } - m := NewManager(client, reception.NewStore(versioned.NewKV(make(ekv.Memstore)))) + m := newManager(client, &reception.Store{}) if e.client != m.client || e.store != m.store || e.net != m.net || e.rng != m.rng || !reflect.DeepEqual(e.p, m.p) {