mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-17 03:27:00 +08:00
21 lines
640 B
Go
21 lines
640 B
Go
package api
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/Wxw-Gu/WechatExplorer/services/wechat-connector/ilink"
|
|
)
|
|
|
|
func TestClientForAccountSelectsMatchingBot(t *testing.T) {
|
|
oldClient := ilink.NewClient(&ilink.Credentials{ILinkBotID: "bot-old"})
|
|
newClient := ilink.NewClient(&ilink.Credentials{ILinkBotID: "bot-new"})
|
|
server := NewServer([]*ilink.Client{oldClient, newClient}, "")
|
|
|
|
if got := server.clientForAccount("bot-new"); got != newClient {
|
|
t.Fatal("clientForAccount did not select the requested account")
|
|
}
|
|
if got := server.clientForAccount("missing"); got != nil {
|
|
t.Fatal("clientForAccount should reject an unknown account")
|
|
}
|
|
}
|