fix: remove duplicate test and fix gci import order
This commit is contained in:
parent
245946f689
commit
2a2233e912
2 changed files with 6 additions and 29 deletions
|
|
@ -6,11 +6,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
lark "github.com/larksuite/oapi-sdk-go/v3"
|
|
||||||
larkcore "github.com/larksuite/oapi-sdk-go/v3/core"
|
|
||||||
larkdispatcher "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher"
|
|
||||||
larkim "github.com/larksuite/oapi-sdk-go/v3/service/im/v1"
|
|
||||||
larkws "github.com/larksuite/oapi-sdk-go/v3/ws"
|
|
||||||
"io"
|
"io"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
@ -21,6 +16,12 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
lark "github.com/larksuite/oapi-sdk-go/v3"
|
||||||
|
larkcore "github.com/larksuite/oapi-sdk-go/v3/core"
|
||||||
|
larkdispatcher "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher"
|
||||||
|
larkim "github.com/larksuite/oapi-sdk-go/v3/service/im/v1"
|
||||||
|
larkws "github.com/larksuite/oapi-sdk-go/v3/ws"
|
||||||
|
|
||||||
"github.com/sipeed/picoclaw/pkg/bus"
|
"github.com/sipeed/picoclaw/pkg/bus"
|
||||||
"github.com/sipeed/picoclaw/pkg/channels"
|
"github.com/sipeed/picoclaw/pkg/channels"
|
||||||
"github.com/sipeed/picoclaw/pkg/config"
|
"github.com/sipeed/picoclaw/pkg/config"
|
||||||
|
|
|
||||||
|
|
@ -279,27 +279,3 @@ func TestExtractFeishuSenderID(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReplyTargetMessageID(t *testing.T) {
|
|
||||||
strPtr := func(s string) *string { return &s }
|
|
||||||
|
|
||||||
t.Run("prefer parent_id", func(t *testing.T) {
|
|
||||||
msg := &larkim.EventMessage{ParentId: strPtr("om_parent"), RootId: strPtr("om_root")}
|
|
||||||
if got := replyTargetID(msg); got != "om_parent" {
|
|
||||||
t.Fatalf("replyTargetID() = %q, want %q", got, "om_parent")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("fallback to root_id", func(t *testing.T) {
|
|
||||||
msg := &larkim.EventMessage{RootId: strPtr("om_root")}
|
|
||||||
if got := replyTargetID(msg); got != "om_root" {
|
|
||||||
t.Fatalf("replyTargetID() = %q, want %q", got, "om_root")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("empty when no fields", func(t *testing.T) {
|
|
||||||
if got := replyTargetID(&larkim.EventMessage{}); got != "" {
|
|
||||||
t.Fatalf("replyTargetID() = %q, want empty", got)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue