yao/integrations/discord/message_test.go
Max 5333302055 Add Discord integration support in robot lifecycle
- Introduce Discord adapter in the robot lifecycle to enable integration with Discord events.
- Update the integration dispatcher to recognize and handle events from Discord.
- Modify the configuration structure to include settings for Discord integration.
- Enhance the integration parsing logic to support Discord configurations.
2026-03-02 07:53:49 +08:00

34 lines
815 B
Go

package discord
import (
"testing"
)
func TestParseWrapper(t *testing.T) {
cases := []struct {
input string
manager string
fileID string
wantErr bool
}{
{"__yao.attachment://abc123", "__yao.attachment", "abc123", false},
{"__custom.uploader://xyz", "__custom.uploader", "xyz", false},
{"no-separator", "", "", true},
}
for _, tc := range cases {
manager, fileID, err := parseWrapper(tc.input)
if tc.wantErr {
if err == nil {
t.Errorf("parseWrapper(%q) expected error, got nil", tc.input)
}
continue
}
if err != nil {
t.Errorf("parseWrapper(%q) unexpected error: %v", tc.input, err)
continue
}
if manager != tc.manager || fileID != tc.fileID {
t.Errorf("parseWrapper(%q) = (%q, %q), want (%q, %q)", tc.input, manager, fileID, tc.manager, tc.fileID)
}
}
}