fix: TestPluggableOutboundAdapter

This commit is contained in:
Toby 2023-07-26 19:20:46 -07:00
parent 1629f0fc8e
commit 7a3c23032b

View file

@ -26,12 +26,10 @@ func TestPluggableOutboundAdapter(t *testing.T) {
Port: 2333, Port: 2333,
}, nil }, nil
}).Once() }).Once()
mc.EXPECT().WriteTo(mock.Anything, &AddrEx{ mc.EXPECT().WriteTo([]byte("gawr"), &AddrEx{
Host: "hololive.tv", Host: "another.hololive.tv",
Port: 8999, Port: 1551,
}).RunAndReturn(func(bs []byte, addr *AddrEx) (int, error) { }).Return(4, nil).Once()
return len(bs), nil
}).Once()
ob.EXPECT().UDP(&AddrEx{ ob.EXPECT().UDP(&AddrEx{
Host: "hololive.tv", Host: "hololive.tv",
Port: 8999, Port: 8999,
@ -40,7 +38,7 @@ func TestPluggableOutboundAdapter(t *testing.T) {
uConn, err := adapter.UDP("hololive.tv:8999") uConn, err := adapter.UDP("hololive.tv:8999")
assert.Nil(t, err) assert.Nil(t, err)
assert.NotNil(t, uConn) assert.NotNil(t, uConn)
n, err := uConn.WriteTo([]byte("gura"), "hololive.tv:8999") n, err := uConn.WriteTo([]byte("gawr"), "another.hololive.tv:1551")
assert.Nil(t, err) assert.Nil(t, err)
assert.Equal(t, 4, n) assert.Equal(t, 4, n)
bs := make([]byte, 1024) bs := make([]byte, 1024)