fix(test): move orphaned test into describe block

Move "clears loading flag when all mutations idle" test inside
the describe("useProviderActions") block for proper test isolation.
This commit is contained in:
YoVinchen
2026-01-30 00:11:11 +08:00
parent 06cde78945
commit b8a53f9e36
3 changed files with 21 additions and 21 deletions
+5 -9
View File
@@ -205,7 +205,9 @@ export const codexAdapter: CommonConfigAdapter<string, string> = {
}
const error = validateTomlFormat(snippet);
if (error) {
return t("codexConfig.tomlFormatError", { defaultValue: "TOML 格式错误" });
return t("codexConfig.tomlFormatError", {
defaultValue: "TOML 格式错误",
});
}
return "";
},
@@ -214,11 +216,7 @@ export const codexAdapter: CommonConfigAdapter<string, string> = {
return extractConfigToml(input);
},
computeFinal: (
custom: string,
common: string,
enabled: boolean,
): string => {
computeFinal: (custom: string, common: string, enabled: boolean): string => {
if (!enabled || !hasTomlContent(common)) {
return custom;
}
@@ -274,9 +272,7 @@ export function createGeminiAdapter(
defaultSnippet: GEMINI_DEFAULT_SNIPPET,
legacyStorageKey: GEMINI_LEGACY_STORAGE_KEY,
parseSnippet: (
snippet: string,
): ParseResult<Record<string, string>> => {
parseSnippet: (snippet: string): ParseResult<Record<string, string>> => {
const result = parseGeminiCommonConfigSnippet(snippet, {
strictForbiddenKeys: true,
});
+4 -1
View File
@@ -176,7 +176,10 @@ export function useCommonConfigBase<TConfig, TFinal>({
initialData,
selectedPresetId,
enabled = true,
}: UseCommonConfigBaseProps<TConfig, TFinal>): UseCommonConfigBaseReturn<TFinal> {
}: UseCommonConfigBaseProps<
TConfig,
TFinal
>): UseCommonConfigBaseReturn<TFinal> {
const { t } = useTranslation();
// ============================================================================
+12 -11
View File
@@ -450,17 +450,18 @@ describe("useProviderActions", () => {
expect(result.current.isLoading).toBe(true);
});
});
it("clears loading flag when all mutations idle", () => {
addProviderMutation.isPending = false;
updateProviderMutation.isPending = false;
deleteProviderMutation.isPending = false;
switchProviderMutation.isPending = false;
const { wrapper } = createWrapper();
const { result } = renderHook(() => useProviderActions("claude"), {
wrapper,
it("clears loading flag when all mutations idle", () => {
addProviderMutation.isPending = false;
updateProviderMutation.isPending = false;
deleteProviderMutation.isPending = false;
switchProviderMutation.isPending = false;
const { wrapper } = createWrapper();
const { result } = renderHook(() => useProviderActions("claude"), {
wrapper,
});
expect(result.current.isLoading).toBe(false);
});
expect(result.current.isLoading).toBe(false);
});