OpenHands Testing: Jest & Pytest Implementation for Full-Stack Applications
The OpenHands repository demonstrates a comprehensive testing approach utilizing both Jest and Pytest frameworks for thorough unit testing coverage. With over 100 test cases, the codebase showcases modern testing practices across frontend React components and backend Python modules, ensuring robust validation of core functionalities like prompt management, UI interactions, and terminal operations. Qodo Tests Hub provides developers with an organized view into OpenHands' testing patterns, making it easier to understand how different components are tested in a real-world application. Through the hub's interactive interface, developers can explore test implementations for specific features, analyze testing strategies for both frontend and backend components, and learn practical approaches to writing effective unit tests for similar applications.
Path | Test Type | Language | Description |
---|---|---|---|
frontend/__tests__/components/modals/base-modal/base-modal.test.tsx |
unit
|
typescript | This Jest unit test verifies the rendering, interaction, and state management of a React BaseModal component. |
frontend/__tests__/components/project-menu/project-menu-card.test.tsx |
unit
|
typescript | This Vitest unit test verifies ProjectMenuCard component’s title management and menu interaction functionality. |
frontend/__tests__/components/settings/ai-config-form.test.tsx |
unit
|
typescript | This Vitest unit test verifies the AIConfigForm component’s rendering, toggle functionality, and callback handling for form submission, reset, and close operations. |
frontend/__tests__/components/settings/model-selector.test.tsx |
unit
|
typescript | This Vitest unit test verifies the ModelSelector component’s rendering, selection states, and disabled conditions for AI model management. |
frontend/__tests__/components/terminal/terminal.test.tsx |
unit
|
typescript | This Jest unit test verifies Terminal component rendering, command processing, and display functionality in a React/Redux environment. |
frontend/__tests__/components/upload-image-input.test.tsx |
unit
|
typescript | This Jest unit test verifies image upload functionality and custom label rendering in the UploadImageInput component. |
frontend/__tests__/components/user-avatar.test.tsx |
unit
|
typescript | This Jest unit test verifies the UserAvatar component’s rendering states, click handling, and loading behavior in React applications. |
frontend/__tests__/initial-query.test.tsx |
unit
|
typescript | This Vitest unit test verifies Redux store state management for initial query setting and clearing operations. |
frontend/__tests__/routes/_oh.app.test.tsx |
unit
|
typescript | This Jest unit test verifies the basic rendering functionality of the OpenHands App component using TypeScript and Vitest. |
frontend/__tests__/routes/_oh.test.tsx |
unit
|
typescript | This React Testing Library unit test verifies the main application route functionality including authentication, settings management, and user consent handling. |