Fix current state server test (sort of)

This commit is contained in:
Neil Alexander 2020-07-29 15:26:56 +01:00
parent d6a6b27c5c
commit 16984262bc
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -15,6 +15,7 @@
package currentstateserver
import (
"bytes"
"context"
"crypto/ed25519"
"encoding/json"
@ -160,8 +161,13 @@ func TestQueryCurrentState(t *testing.T) {
t.Errorf("QueryCurrentState want tuple %+v but it is missing from the response", tuple)
continue
}
if !reflect.DeepEqual(gotEvent.JSON(), wantEvent.JSON()) {
t.Errorf("QueryCurrentState tuple %+v got event JSON %s want %s", tuple, string(gotEvent.JSON()), string(wantEvent.JSON()))
gotCanon, err := gomatrixserverlib.CanonicalJSON(gotEvent.JSON())
if err != nil {
t.Errorf("CanonicalJSON failed: %w", err)
continue
}
if !bytes.Equal(gotCanon, wantEvent.JSON()) {
t.Errorf("QueryCurrentState tuple %+v got event JSON %s want %s", tuple, string(gotCanon), string(wantEvent.JSON()))
}
}
}