diff --git a/internal/shortcut/minutes/alignment.go b/internal/shortcut/minutes/alignment.go index d429734a..21d35464 100644 --- a/internal/shortcut/minutes/alignment.go +++ b/internal/shortcut/minutes/alignment.go @@ -224,7 +224,7 @@ func executeMinutesSearch(rt *shortcut.RuntimeContext) error { if err != nil { return err } - belonging := map[string]string{"mine": "created", "shared": "shared", "all": "noLimit"}[rt.Str("scope")] + belonging := map[string]string{"mine": "createdByMe", "shared": "sharedToMe", "all": "noLimit"}[rt.Str("scope")] token := rt.Str("cursor") seenTokens := map[string]bool{} seenIDs := map[string]bool{} diff --git a/internal/shortcut/minutes/alignment_e2e_test.go b/internal/shortcut/minutes/alignment_e2e_test.go index bb41cfc7..01b09a94 100644 --- a/internal/shortcut/minutes/alignment_e2e_test.go +++ b/internal/shortcut/minutes/alignment_e2e_test.go @@ -10,6 +10,7 @@ import ( "errors" "os" "path/filepath" + "reflect" "testing" apperrors "github.com/DingTalk-Real-AI/dingtalk-workspace-cli/internal/errors" @@ -108,6 +109,30 @@ func TestCrossPlatformCoverageMinutesSearchPaginatesFiltersAndRejectsUnknownE2E( t.Fatalf("search calls=%#v", calls) } + for _, test := range []struct { + scope string + belonging string + }{ + {scope: "mine", belonging: "createdByMe"}, + {scope: "shared", belonging: "sharedToMe"}, + {scope: "all", belonging: "noLimit"}, + } { + t.Run("scope "+test.scope, func(t *testing.T) { + scoped := &minutesE2ECaller{responses: map[string][]string{ + "minutes/list_by_keyword_and_time_range": {`{"success":true,"result":{"itemList":[],"hasNext":false}}`}, + }} + payload, _, err := runMinutesAlignmentCLI(t, scoped, "minutes", "+search", "--query", "needle", "--scope", test.scope, "--limit", "1") + if err != nil || payload["count"] != float64(0) || payload["complete"] != true { + t.Fatalf("scope %s payload=%#v err=%v", test.scope, payload, err) + } + calls := scoped.arguments["minutes/list_by_keyword_and_time_range"] + want := map[string]any{"belongingConditionId": test.belonging, "keyword": "needle", "maxResults": 1} + if len(calls) != 1 || !reflect.DeepEqual(calls[0], want) { + t.Fatalf("scope %s calls=%#v, want exactly %#v", test.scope, calls, want) + } + }) + } + unknown := &minutesE2ECaller{responses: map[string][]string{"minutes/list_by_keyword_and_time_range": {`{"success":true,"result":{}}`}}} if payload, output, err := runMinutesAlignmentCLI(t, unknown, "minutes", "+search", "--query", "周会"); err == nil || payload != nil || output != "" { t.Fatalf("unknown list accepted: payload=%#v output=%q err=%v", payload, output, err)