MCPcopy
hub / github.com/larksuite/cli / TestLookupCodeMeta_DriveCodes

Function TestLookupCodeMeta_DriveCodes

internal/errclass/codemeta_drive_test.go:16–50  ·  view source on GitHub ↗

TestLookupCodeMeta_DriveCodes pins each drive-service code registered via the codemeta_drive.go init() merge to its expected Category/Subtype/Retryable. Each case traces to repo evidence (see codemeta_drive.go comments).

(t *testing.T)

Source from the content-addressed store, hash-verified

14// codemeta_drive.go init() merge to its expected Category/Subtype/Retryable.
15// Each case traces to repo evidence (see codemeta_drive.go comments).
16func TestLookupCodeMeta_DriveCodes(t *testing.T) {
17 cases := []struct {
18 code int
19 wantCat errs.Category
20 wantSubtype errs.Subtype
21 wantRetry bool
22 }{
23 // 1061044: upload with a nonexistent parent folder token. The drive E2E
24 // (tests_e2e/drive/2026_06_01_errs_migrate_drive_test.go) drives this
25 // producer via a nonexistent parent folder → referenced resource missing.
26 {1061044, errs.CategoryAPI, errs.SubtypeNotFound, false},
27 // 1069302: comment endpoint's opaque "Invalid or missing parameters"
28 // (shortcuts/drive/drive_add_comment.go) → API-side parameter rejection.
29 {1069302, errs.CategoryAPI, errs.SubtypeInvalidParameters, false},
30 // Secure label endpoint codes observed from drive +secure-label-update
31 // failure telemetry.
32 {1063001, errs.CategoryAPI, errs.SubtypeInvalidParameters, false},
33 {1063002, errs.CategoryAuthorization, errs.SubtypePermissionDenied, false},
34 {1063013, errs.CategoryValidation, errs.SubtypeFailedPrecondition, false},
35 {99992402, errs.CategoryAPI, errs.SubtypeInvalidParameters, false},
36 {9499, errs.CategoryAPI, errs.SubtypeInvalidParameters, false},
37 }
38 for _, tc := range cases {
39 t.Run(fmt.Sprintf("%d", tc.code), func(t *testing.T) {
40 meta, ok := LookupCodeMeta(tc.code)
41 if !ok {
42 t.Fatalf("code %d not registered in codeMeta", tc.code)
43 }
44 if meta.Category != tc.wantCat || meta.Subtype != tc.wantSubtype || meta.Retryable != tc.wantRetry {
45 t.Errorf("code %d: got %+v, want Category=%v Subtype=%v Retryable=%v",
46 tc.code, meta, tc.wantCat, tc.wantSubtype, tc.wantRetry)
47 }
48 })
49 }
50}

Callers

nothing calls this directly

Calls 2

LookupCodeMetaFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected