golang-im聊天
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

message_service_test.go 668 B

2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940
  1. package service
  2. import (
  3. "context"
  4. "fmt"
  5. "testing"
  6. jsoniter "github.com/json-iterator/go"
  7. )
  8. func TestMessageService_Add(t *testing.T) {
  9. }
  10. func TestMessageService_ListByUserIdAndSequence(t *testing.T) {
  11. }
  12. func TestJson(t *testing.T) {
  13. var st = struct {
  14. Nickname string `json:"nickname"`
  15. }{}
  16. json := `{
  17. "user_id":3,
  18. "nickname":"h",
  19. "sex":2,
  20. "avatar_url":"no",
  21. "extra":{"nickname":"hjkladsjfkl"}
  22. }`
  23. jsoniter.Get([]byte(json), "extra").ToVal(&st)
  24. fmt.Println(st)
  25. }
  26. func Test_messageService_Sync(t *testing.T) {
  27. resp, err := MessageService.Sync(context.TODO(), 6, 0)
  28. fmt.Println(err)
  29. fmt.Println(resp.HasMore)
  30. fmt.Println(len(resp.Messages))
  31. }