chat_test.go 806 B

123456789101112131415161718192021222324252627
  1. package state
  2. import (
  3. "testing"
  4. "github.com/mk6i/retro-aim-server/wire"
  5. "github.com/stretchr/testify/assert"
  6. )
  7. func TestChatRoom_TLVList(t *testing.T) {
  8. room := NewChatRoom("chat-room-name", NewIdentScreenName(""), PublicExchange)
  9. have := room.TLVList()
  10. want := []wire.TLV{
  11. wire.NewTLVBE(wire.ChatRoomTLVFlags, uint16(15)),
  12. wire.NewTLVBE(wire.ChatRoomTLVCreateTime, uint32(room.createTime.Unix())),
  13. wire.NewTLVBE(wire.ChatRoomTLVMaxMsgLen, uint16(1024)),
  14. wire.NewTLVBE(wire.ChatRoomTLVMaxOccupancy, uint16(100)),
  15. wire.NewTLVBE(wire.ChatRoomTLVNavCreatePerms, uint8(2)),
  16. wire.NewTLVBE(wire.ChatRoomTLVFullyQualifiedName, room.name),
  17. wire.NewTLVBE(wire.ChatRoomTLVRoomName, room.name),
  18. wire.NewTLVBE(wire.ChatRoomTLVMaxMsgVisLen, uint16(1024)),
  19. }
  20. assert.Equal(t, want, have)
  21. }