(t *testing.T)
| 103 | } |
| 104 | |
| 105 | func 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 | |
| 134 | func TestLookupCodeMeta_Unknown(t *testing.T) { |
| 135 | _, ok := LookupCodeMeta(999999) |
nothing calls this directly
no test coverage detected