mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-15 11:21:04 +01:00
2ad899b066
* test: add conn tests * test: add ConnStatus tests * test: add error test * test: add more conn tests
28 lines
742 B
Go
28 lines
742 B
Go
package peer
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestNewConnectionClosedError(t *testing.T) {
|
|
err := NewConnectionClosedError("X")
|
|
assert.Equal(t, &ConnectionClosedError{peer: "X"}, err)
|
|
}
|
|
|
|
func TestNewConnectionDisconnectedError(t *testing.T) {
|
|
err := NewConnectionDisconnectedError("X")
|
|
assert.Equal(t, &ConnectionDisconnectedError{peer: "X"}, err)
|
|
}
|
|
|
|
func TestNewConnectionTimeoutErrorC(t *testing.T) {
|
|
err := NewConnectionTimeoutError("X", time.Second)
|
|
assert.Equal(t, &ConnectionTimeoutError{peer: "X", timeout: time.Second}, err)
|
|
}
|
|
|
|
func TestNewConnectionAlreadyClosed(t *testing.T) {
|
|
err := NewConnectionAlreadyClosed("X")
|
|
assert.Equal(t, &ConnectionAlreadyClosedError{peer: "X"}, err)
|
|
}
|