mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
Add test
This commit is contained in:
parent
bbc325ff96
commit
91b5ba6c75
1 changed files with 20 additions and 5 deletions
|
@ -3,15 +3,17 @@ package nodeconf
|
|||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/anyproto/any-sync/app"
|
||||
"github.com/anyproto/any-sync/net"
|
||||
"github.com/anyproto/any-sync/net/secureservice/handshake"
|
||||
"github.com/anyproto/any-sync/testutil/accounttest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
var ctx = context.Background()
|
||||
|
@ -72,6 +74,19 @@ func TestService_NetworkCompatibilityStatus(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestService_NetworkGetLast(t *testing.T) {
|
||||
t.Run("same configuration error does not cause empty one to be set", func(t *testing.T) {
|
||||
fx := newFixture(t)
|
||||
fx.testSource.call = func() (Configuration, error) {
|
||||
return Configuration{}, ErrConfigurationNotChanged
|
||||
}
|
||||
defer fx.finish(t)
|
||||
fx.run(t)
|
||||
time.Sleep(time.Millisecond * 10)
|
||||
assert.NotEmpty(t, fx.Configuration().Id)
|
||||
})
|
||||
}
|
||||
|
||||
func newFixture(t *testing.T) *fixture {
|
||||
fx := &fixture{
|
||||
Service: New(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue