github.com/v2fly/v2ray-core/v4@v4.45.2/transport/internet/headers/wechat/wechat_test.go (about)

     1  package wechat_test
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/v2fly/v2ray-core/v4/common"
     8  	"github.com/v2fly/v2ray-core/v4/common/buf"
     9  	. "github.com/v2fly/v2ray-core/v4/transport/internet/headers/wechat"
    10  )
    11  
    12  func TestUTPWrite(t *testing.T) {
    13  	videoRaw, err := NewVideoChat(context.Background(), &VideoConfig{})
    14  	common.Must(err)
    15  
    16  	video := videoRaw.(*VideoChat)
    17  
    18  	payload := buf.New()
    19  	video.Serialize(payload.Extend(video.Size()))
    20  
    21  	if payload.Len() != video.Size() {
    22  		t.Error("expected payload size ", video.Size(), " but got ", payload.Len())
    23  	}
    24  }