feat: add private r2 bucket
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package handler
|
||||
|
||||
import "testing"
|
||||
|
||||
// Both channel names must resolve during the private-channel migration:
|
||||
// matching only one would silently stop evicting feed seen-sets for every
|
||||
// client still on the other name.
|
||||
func TestUserIDFromNotifChannel(t *testing.T) {
|
||||
tests := []struct {
|
||||
channel string
|
||||
wantID string
|
||||
wantOK bool
|
||||
}{
|
||||
{"private-notifications.user-a", "user-a", true},
|
||||
{"notifications.user-a", "user-a", true},
|
||||
{"private-notifications.", "", false},
|
||||
{"notifications.", "", false},
|
||||
{"presence-conversation.c1", "", false},
|
||||
{"", "", false},
|
||||
// Guards against a naive suffix split: the private name must not be
|
||||
// mistaken for the legacy one and yield a mangled id.
|
||||
{"private-notifications.notifications.x", "notifications.x", true},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
gotID, gotOK := userIDFromNotifChannel(tc.channel)
|
||||
if gotOK != tc.wantOK || (tc.wantOK && gotID != tc.wantID) {
|
||||
t.Errorf("userIDFromNotifChannel(%q) = (%q, %v), want (%q, %v)",
|
||||
tc.channel, gotID, gotOK, tc.wantID, tc.wantOK)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user