mirror of
https://github.com/larksuite/cli.git
synced 2026-09-14 18:42:53 +08:00
2a1613484a
* feat: add framework flag aliases and unified IM pagination Introduce declarative exact-name flag aliases at the shortcut framework boundary while keeping semantic compatibility domain-owned. Add a shared, format-aware IM pagination pipeline with consistent flags, metadata, safety bounds, resumable cursors, and request throttling. * fix: align alias attribution and pagination contracts * fix: align alias contracts and documentation * test: remove environment-dependent contact bot e2e * test: restore contact bot e2e * docs: reduce IM pagination guidance noise --------- Co-authored-by: liangshuo-1 <266696938+liangshuo-1@users.noreply.github.com>
57 lines
1.2 KiB
Go
57 lines
1.2 KiB
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package sheets
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
)
|
|
|
|
func TestShortcutsDeclareSpreadsheetTokenAlias(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
count := 0
|
|
for _, shortcut := range Shortcuts() {
|
|
for _, flag := range shortcut.Flags {
|
|
if flag.Name != "spreadsheet-token" {
|
|
continue
|
|
}
|
|
count++
|
|
if !slices.Contains(flag.Aliases, "token") {
|
|
t.Errorf("%s --spreadsheet-token aliases = %v, want token", shortcut.Command, flag.Aliases)
|
|
}
|
|
}
|
|
}
|
|
if count == 0 {
|
|
t.Fatal("expected at least one sheets shortcut with --spreadsheet-token")
|
|
}
|
|
}
|
|
|
|
func TestShortcutsDoNotAccumulateSpreadsheetTokenAliases(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
for call := 0; call < 2; call++ {
|
|
for _, shortcut := range Shortcuts() {
|
|
for _, flag := range shortcut.Flags {
|
|
if flag.Name != "spreadsheet-token" {
|
|
continue
|
|
}
|
|
if got := countString(flag.Aliases, "token"); got != 1 {
|
|
t.Fatalf("call %d: %s has %d token aliases: %v", call+1, shortcut.Command, got, flag.Aliases)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
func countString(values []string, target string) int {
|
|
count := 0
|
|
for _, value := range values {
|
|
if value == target {
|
|
count++
|
|
}
|
|
}
|
|
return count
|
|
}
|