MCPcopy Index your code
hub / github.com/larksuite/cli / TestLookupCodeMeta_DrivePushCodes

Function TestLookupCodeMeta_DrivePushCodes

internal/errclass/codemeta_test.go:105–132  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

103}
104
105func TestLookupCodeMeta_DrivePushCodes(t *testing.T) {
106 cases := []struct {
107 code int
108 wantCat errs.Category
109 wantSubtype errs.Subtype
110 wantRetry bool
111 }{
112 {1061001, errs.CategoryAPI, errs.SubtypeServerError, true},
113 {1061002, errs.CategoryAPI, errs.SubtypeInvalidParameters, false},
114 {1061004, errs.CategoryAuthorization, errs.SubtypePermissionDenied, false},
115 {1061007, errs.CategoryAPI, errs.SubtypeNotFound, false},
116 {1061043, errs.CategoryAPI, errs.SubtypeQuotaExceeded, false},
117 {1062009, errs.CategoryAPI, errs.SubtypeInvalidParameters, false},
118 {2200, errs.CategoryAPI, errs.SubtypeServerError, true},
119 }
120 for _, tc := range cases {
121 t.Run(fmt.Sprintf("%d", tc.code), func(t *testing.T) {
122 got, ok := LookupCodeMeta(tc.code)
123 if !ok {
124 t.Fatalf("LookupCodeMeta(%d) ok=false, want true", tc.code)
125 }
126 if got.Category != tc.wantCat || got.Subtype != tc.wantSubtype || got.Retryable != tc.wantRetry {
127 t.Fatalf("LookupCodeMeta(%d) = %+v, want Category=%v Subtype=%v Retryable=%v",
128 tc.code, got, tc.wantCat, tc.wantSubtype, tc.wantRetry)
129 }
130 })
131 }
132}
133
134func TestLookupCodeMeta_Unknown(t *testing.T) {
135 _, ok := LookupCodeMeta(999999)

Callers

nothing calls this directly

Calls 2

LookupCodeMetaFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected