21 lines
451 B
Go
21 lines
451 B
Go
|
package glist
|
||
|
|
||
|
import (
|
||
|
"sync"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestGList(t *testing.T) {
|
||
|
var ti int
|
||
|
var m sync.Mutex
|
||
|
g := GList{ti, m, 4342, nil, []Entry{{"foo", true}}}
|
||
|
data, err := g.GenSendListReq()
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
expected := `{"chat_id":4342,"text":"ok","reply_markup":{"inline_keyboard":[[{"text":"✓ foo","callback_data":"foo"}]]}}`
|
||
|
if expected != string(data) {
|
||
|
t.Fatalf("expected: %s\n got:%s\n", expected, string(data))
|
||
|
}
|
||
|
}
|