From 70ef1d575f020e7ba247af484df78dac5870ee83 Mon Sep 17 00:00:00 2001 From: rcorniere Date: Fri, 31 Jan 2020 12:06:53 +0100 Subject: [PATCH] Reset Tests Will come with MaM (XEP-313) implementation --- stanza/results_sets_test.go | 67 +++++-------------------------------- 1 file changed, 8 insertions(+), 59 deletions(-) diff --git a/stanza/results_sets_test.go b/stanza/results_sets_test.go index 25d085e..2ddd123 100644 --- a/stanza/results_sets_test.go +++ b/stanza/results_sets_test.go @@ -1,79 +1,28 @@ package stanza_test import ( - "encoding/xml" "gosrc.io/xmpp/stanza" "testing" ) // Limiting the number of items func TestNewResultSetReq(t *testing.T) { - expectedRq := " " + - "Pete 10 " - - items := []stanza.Node{ - { - XMLName: xml.Name{Local: "nick"}, - Content: "Pete", - }, - } + expectedRq := " " + + " " + + "urn:xmpp:mam:2 2010-08-07T00:00:00Z " + + " 10 " maxVal := 10 rs := &stanza.ResultSet{ Max: &maxVal, } - rq, err := stanza.NewResultSetReq("users.jabber.org", "jabber:iq:search", items, rs) - if err != nil { - t.Fatalf("failed to build the result set request : %v", err) - } - rq.Id = "limit1" - - data, err := xml.Marshal(rq) - if err := compareMarshal(expectedRq, string(data)); err != nil { - t.Fatalf(err.Error()) - } + // TODO when Mam is implemented + _ = expectedRq + _ = rs } func TestUnmarshalResultSeqReq(t *testing.T) { - //expectedRq := " " + - // "Pete 10 " - //var uReq stanza.IQ - //err := xml.Unmarshal([]byte(expectedRq), &uReq) - //if err != nil { - // t.Fatalf(err.Error()) - //} - //items := []stanza.Node{ - // { - // XMLName: xml.Name{Local: "nick"}, - // Content: "Pete", - // }, - //} - // - //maxVal := 10 - //rs := &stanza.ResultSet{ - // XMLName: xml.Name{Local: "set", Space: "http://jabber.org/protocol/rsm"}, - // Max: &maxVal, - //} - // - //rq, err := stanza.NewResultSetReq("users.jabber.org", "jabber:iq:search", items, rs) - //if err != nil { - // t.Fatalf("failed to build the result set request : %v", err) - //} - //rq.Id = "limit1" - // - //// Namespace is unmarshalled as of parent for nodes in the payload. To DeepEqual, we need to set the namespace in - //// the "expectedRq" - //n, ok := rq.Payload.(*stanza.QuerySet) - //if !ok { - // t.Fatalf("payload is not a query set: %v", ok) - //} - //n.Nodes[0].XMLName.Space = stanza.NSQuerySet - // - //data, err := xml.Marshal(rq) - //fmt.Println(string(data)) - //if !reflect.DeepEqual(rq, uReq) { - // t.Fatalf("nope") - //} + // TODO when Mam is implemented }