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/settings/model-selector.test.tsx |
unit
|
typescript | This Jest unit test verifies the ModelSelector component’s provider selection and model handling functionality across multiple LLM platforms. |
frontend/__tests__/components/settings/dropdown-input.test.tsx |
unit
|
typescript | This Vitest unit test verifies the rendering, interaction, and filtering functionality of a DropdownInput component. |
frontend/__tests__/components/suggestion-item.test.tsx |
unit
|
typescript | This React unit test verifies the rendering and click behavior of the SuggestionItem component using React Testing Library and Vitest. |
frontend/__tests__/utils/format-time-delta.test.ts |
unit
|
typescript | This Jest unit test verifies the formatting of time differences into human-readable strings with various time units. |
frontend/__tests__/components/suggestions.test.tsx |
unit
|
typescript | This Jest unit test verifies the rendering and interaction behavior of the Suggestions component in React. |
frontend/__tests__/hooks/use-click-outside-element.test.tsx |
unit
|
typescript | This Jest unit test verifies the useClickOutsideElement React hook’s callback behavior when clicking inside and outside a referenced element. |
frontend/__tests__/hooks/use-terminal.test.tsx |
unit
|
typescript | This Jest unit test verifies the useTerminal React hook’s rendering, command processing, and secret masking functionality. |
frontend/__tests__/utils/handle-capture-consent.test.ts |
unit
|
typescript | This Vitest unit test verifies PostHog analytics capture consent handling functionality in the frontend application. |
frontend/__tests__/utils/map-provider.test.ts |
unit
|
typescript | This Jest unit test verifies the correct mapping of AI provider identifiers to their standardized display names. |
frontend/__tests__/utils/parse-terminal-output.test.ts |
unit
|
typescript | This Vitest unit test verifies the parsing of terminal output containing Python interpreter information and command prompts. |