~samwhited/xmpp

xmpp/commands/notes_test.go -rw-r--r-- 832 bytes
91959039Sam Whited xtime: re-enable ejabberd integration tests an hour ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2021 The Mellium Contributors.
// Use of this source code is governed by the BSD 2-clause
// license that can be found in the LICENSE file.

package commands_test

import (
	"encoding/xml"
	"testing"

	"mellium.im/xmpp/commands"
	"mellium.im/xmpp/internal/xmpptest"
)

func TestNotes(t *testing.T) {
	xmpptest.RunEncodingTests(t, []xmpptest.EncodingTestCase{
		{
			Value: &commands.Note{XMLName: xml.Name{Local: "note"}},
			XML:   `<note type="info"></note>`,
		},
		{
			Value: &commands.Note{XMLName: xml.Name{Local: "note"}, Type: commands.NoteError, Value: "foo"},
			XML:   `<note type="error">foo</note>`,
		},
		{
			Value:       &commands.Note{XMLName: xml.Name{Local: "note"}, Type: commands.NoteType(5), Value: "foo"},
			XML:         `<note type="NoteType(5)">foo</note>`,
			NoUnmarshal: true,
		},
	})
}