* wip: backup * wip: backup * wip: backup * backup * backup * backup * add more tests * fix wrong dependency * fix lint errors * remove test due to data race * add tests * fix test error * add mon.Model * add mon.Model unmarshal * add monc * add more tests for monc * add more tests for monc * add docs for mon and monc packages * fix doc errors * chhore: add comment * chore: fix test bug * chore: refine tests * chore: remove primitive.NewObjectID in test code * chore: rename test files for typo
36 lines
475 B
Go
36 lines
475 B
Go
package mon
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestFormatAddrs(t *testing.T) {
|
|
tests := []struct {
|
|
addrs []string
|
|
expect string
|
|
}{
|
|
{
|
|
addrs: []string{"a", "b"},
|
|
expect: "a,b",
|
|
},
|
|
{
|
|
addrs: []string{"a", "b", "c"},
|
|
expect: "a,b,c",
|
|
},
|
|
{
|
|
addrs: []string{},
|
|
expect: "",
|
|
},
|
|
{
|
|
addrs: nil,
|
|
expect: "",
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
assert.Equal(t, test.expect, FormatAddr(test.addrs))
|
|
}
|
|
}
|