From 6fbfe9fd0a422c49ca333f20803b329fa9b42b95 Mon Sep 17 00:00:00 2001 From: genofire Date: Mon, 24 Jun 2019 12:20:44 +0200 Subject: [PATCH] Update pres_muc_test.go --- pres_muc_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/pres_muc_test.go b/pres_muc_test.go index b2120e3..7200fc0 100644 --- a/pres_muc_test.go +++ b/pres_muc_test.go @@ -58,3 +58,35 @@ func TestMucHistory(t *testing.T) { t.Errorf("incorrect max stanza: '%d'", muc.History.MaxStanzas) } } + +// https://xmpp.org/extensions/xep-0045.html#example-37 +func TestMucNoHistory(t *testing.T) { + str := ` + + + +` + + pres := xmpp.Presence{Attrs: xmpp.Attrs{ + From: "hag66@shakespeare.lit/pda", + Id: "n13mt3l", + To: "coven@chat.shakespeare.lit/thirdwitch", + }, + Extensions: []xmpp.PresExtension{ + xmpp.MucPresence{ + History: xmpp.History{MaxStanzas: 0}, + }, + }, + } + data, err := xml.Marshal(&pres) + if err != nil { + t.Error("error on encode:", err) + } + + if data != str { + t.Errorf("incorrect max stanza: '%d'", muc.History.MaxStanzas) + } +}