test: add directory browsing/reset and useSettings hook tests
SettingsDialog Integration Tests: - Add test for directory browsing and reset functionality - Verify app config directory browse/reset flow - Verify Claude config directory manual change, browse, and reset - Test multiple directory inputs with getAllByTitle pattern - Add test for export failure error handling - User cancels file selection (save_file_dialog returns null) - Export operation fails (disk full scenario) - Use server.use() to dynamically override MSW handlers - Verify toast error messages match i18n keys MSW Handler Extension: - Add pick_directory handler to support directory selection API - Consistent with select_config_directory mock strategy useSettings Hook Unit Tests: - Add comprehensive tests for settings save logic - Test restart flag when app config directory changes - Test no restart when directory unchanged - Verify space trimming and empty string to undefined conversion - Test Claude plugin sync failure tolerance - Add test for settings reset functionality - Verify form/language/directories reset with server data - Use factory functions for mock creation (reusability) - Complete dependency isolation with mock hooks All tests passing: 9/9 (5 integration + 4 unit tests)
This commit is contained in:
@@ -138,6 +138,11 @@ export const handlers = [
|
||||
return success(default_path ? `${default_path}/picked` : "/mock/selected-dir");
|
||||
}),
|
||||
|
||||
http.post(`${TAURI_ENDPOINT}/pick_directory`, async ({ request }) => {
|
||||
const { default_path } = await withJson<{ default_path?: string }>(request);
|
||||
return success(default_path ? `${default_path}/picked` : "/mock/selected-dir");
|
||||
}),
|
||||
|
||||
http.post(`${TAURI_ENDPOINT}/open_file_dialog`, () =>
|
||||
success("/mock/import-settings.json"),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user