mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-24 04:31:39 +00:00
3691423626
GMSL is intended for Federation only. Sister PR to https://github.com/matrix-org/gomatrixserverlib/pull/357
73 lines
1.3 KiB
Go
73 lines
1.3 KiB
Go
package shared
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/matrix-org/dendrite/syncapi/synctypes"
|
|
)
|
|
|
|
func Test_isStatefilterEmpty(t *testing.T) {
|
|
filterSet := []string{"a"}
|
|
boolValue := false
|
|
|
|
tests := []struct {
|
|
name string
|
|
filter *synctypes.StateFilter
|
|
want bool
|
|
}{
|
|
{
|
|
name: "nil filter is empty",
|
|
filter: nil,
|
|
want: true,
|
|
},
|
|
{
|
|
name: "Empty filter is empty",
|
|
filter: &synctypes.StateFilter{},
|
|
want: true,
|
|
},
|
|
{
|
|
name: "NotTypes is set",
|
|
filter: &synctypes.StateFilter{
|
|
NotTypes: &filterSet,
|
|
},
|
|
},
|
|
{
|
|
name: "Types is set",
|
|
filter: &synctypes.StateFilter{
|
|
Types: &filterSet,
|
|
},
|
|
},
|
|
{
|
|
name: "Senders is set",
|
|
filter: &synctypes.StateFilter{
|
|
Senders: &filterSet,
|
|
},
|
|
},
|
|
{
|
|
name: "NotSenders is set",
|
|
filter: &synctypes.StateFilter{
|
|
NotSenders: &filterSet,
|
|
},
|
|
},
|
|
{
|
|
name: "NotRooms is set",
|
|
filter: &synctypes.StateFilter{
|
|
NotRooms: &filterSet,
|
|
},
|
|
},
|
|
{
|
|
name: "ContainsURL is set",
|
|
filter: &synctypes.StateFilter{
|
|
ContainsURL: &boolValue,
|
|
},
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := isStatefilterEmpty(tt.filter); got != tt.want {
|
|
t.Errorf("isStatefilterEmpty() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|