1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00
This commit is contained in:
mcrakhman 2024-08-26 19:07:40 +02:00
parent bbc325ff96
commit 91b5ba6c75
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B

View file

@ -3,15 +3,17 @@ package nodeconf
import ( import (
"context" "context"
"errors" "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/app"
"github.com/anyproto/any-sync/net" "github.com/anyproto/any-sync/net"
"github.com/anyproto/any-sync/net/secureservice/handshake" "github.com/anyproto/any-sync/net/secureservice/handshake"
"github.com/anyproto/any-sync/testutil/accounttest" "github.com/anyproto/any-sync/testutil/accounttest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"sync"
"testing"
"time"
) )
var ctx = context.Background() 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 { func newFixture(t *testing.T) *fixture {
fx := &fixture{ fx := &fixture{
Service: New(), Service: New(),