bf9395e022
CI / results (push) Blocked by required conditions
CI / license-header (push) Has been skipped
CI / e2e-dry-run (push) Has been skipped
CI / e2e-live (push) Waiting to run
CI / fast-gate (push) Failing after 0s
Test PR Label Logic / test-pr-labels (push) Failing after 1s
Skill Format Check / check-format (push) Failing after 2s
CI / security (push) Failing after 5s
CI / unit-test (push) Has been skipped
CI / lint (push) Has been skipped
CI / script-test (push) Has been skipped
CI / deterministic-gate (push) Has been skipped
CI / coverage (push) Has been skipped
CI / deadcode (push) Waiting to run
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package errclass
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/larksuite/cli/errs"
|
|
)
|
|
|
|
// TestLookupCodeMeta_CalendarCodes pins each calendar-service code registered
|
|
// via the codemeta_calendar.go init() merge to its expected
|
|
// Category/Subtype/Retryable.
|
|
func TestLookupCodeMeta_CalendarCodes(t *testing.T) {
|
|
cases := []struct {
|
|
code int
|
|
wantCat errs.Category
|
|
wantSubtype errs.Subtype
|
|
wantRetry bool
|
|
}{
|
|
// 190014: calendar "invalid params" with a field-level detail
|
|
// (error.details[].value) lifted into Hint by BuildAPIError.
|
|
{190014, errs.CategoryAPI, errs.SubtypeInvalidParameters, false},
|
|
}
|
|
for _, tc := range cases {
|
|
t.Run(fmt.Sprintf("%d", tc.code), func(t *testing.T) {
|
|
meta, ok := LookupCodeMeta(tc.code)
|
|
if !ok {
|
|
t.Fatalf("code %d not registered in codeMeta", tc.code)
|
|
}
|
|
if meta.Category != tc.wantCat || meta.Subtype != tc.wantSubtype || meta.Retryable != tc.wantRetry {
|
|
t.Errorf("code %d: got %+v, want Category=%v Subtype=%v Retryable=%v",
|
|
tc.code, meta, tc.wantCat, tc.wantSubtype, tc.wantRetry)
|
|
}
|
|
})
|
|
}
|
|
}
|