Test conn (#199)

* test: add conn tests

* test: add ConnStatus tests

* test: add error test

* test: add more conn tests
This commit is contained in:
Mikhail Bragin
2022-01-21 13:52:19 +01:00
committed by GitHub
parent dfa67410b5
commit 2ad899b066
8 changed files with 245 additions and 9 deletions

View File

@@ -0,0 +1,27 @@
package peer
import (
"github.com/magiconair/properties/assert"
"testing"
)
func TestConnStatus_String(t *testing.T) {
tables := []struct {
name string
status ConnStatus
want string
}{
{"StatusConnected", StatusConnected, "StatusConnected"},
{"StatusDisconnected", StatusDisconnected, "StatusDisconnected"},
{"StatusConnecting", StatusConnecting, "StatusConnecting"},
}
for _, table := range tables {
t.Run(table.name, func(t *testing.T) {
got := table.status.String()
assert.Equal(t, got, table.want, "they should be equal")
})
}
}