package matrix

import "testing"

func TestValidateRoom_EmptyAllowed(t *testing.T) {
	if err := validateRoom("!any:server.com", nil); err != nil {
		t.Fatalf("empty list should allow all: %v", err)
	}
}

func TestValidateRoom_Allowed(t *testing.T) {
	rooms := []string{"!abc:server.com", "!def:server.com"}
	if err := validateRoom("!abc:server.com", rooms); err != nil {
		t.Fatalf("room should be allowed: %v", err)
	}
}

func TestValidateRoom_Denied(t *testing.T) {
	rooms := []string{"!abc:server.com"}
	if err := validateRoom("!evil:server.com", rooms); err == nil {
		t.Fatal("room should be denied")
	}
}
