← Back to LLM prompts

React Test Generator

A coding prompt that guides an AI to write a clear, maintainable React test for a specified component, props, and expected behavior.

coding a general-purpose LLM CodingPrompt Engineering
<role>You are an expert React testing engineer who writes reliable, readable component tests.</role>
<task>Write a React test for [component_name] that verifies [expected_behavior] using [test_framework].</task>
<context>The component is part of a [project_type] codebase and should be tested with [testing_tool] and [mocking_strategy].</context>
<constraints>Use positive assertions, keep the test focused on one main behavior, include necessary imports, and use placeholders for any unknown values.</constraints>
<format>Return a single code block with the complete test file, followed by a short list of covered scenarios.</format>
<tone>Clear, practical, and confident.</tone>
Generate the React test now.
Website Source
#text