mirror of
https://gitee.com/wanwujie/sub2api
synced 2026-05-04 21:20:51 +08:00
fix(lint): check type assertion error in codex transform test
The errcheck linter flagged an unchecked type assertion on item["type"].(string). Use the two-value form with require.True to satisfy the linter and fail clearly on unexpected types.
This commit is contained in:
@@ -1176,7 +1176,9 @@ func TestFilterCodexInput_DropsReasoningItemsRegardlessOfPreserveReferences(t *t
|
||||
for _, raw := range filtered {
|
||||
item, ok := raw.(map[string]any)
|
||||
require.True(t, ok)
|
||||
gotTypes[item["type"].(string)]++
|
||||
typ, ok := item["type"].(string)
|
||||
require.True(t, ok)
|
||||
gotTypes[typ]++
|
||||
}
|
||||
require.Equal(t, 1, gotTypes["message"])
|
||||
require.Equal(t, 1, gotTypes["function_call"])
|
||||
|
||||
Reference in New Issue
Block a user