Write Jest unit tests for this function/module. Cover normal cases, edge cases, error handling, and mock [dependencies]. Use descriptive test names and arrange-act-assert structure. Code: [paste code]
Results for “unit tests”
4 prompts
Write a Python class for [purpose, e.g. a shopping cart]. Include type hints, docstrings, validation, a clean public API, and pytest unit tests covering normal use and edge cases.
Write a Python class with tests
A well-designed Python class with type hints and unit tests.
Act as a senior [language] developer. Write a function that: [describe behaviour] Inputs: [names, types, examples] Output: [type and example] Constraints: [performance, no external libraries, etc.] Include: - Type hints/annotations and a docstring - Input validation and clear error messages - Handling for edge cases (…
Write a function from a plain-English description
Describe what a function should do and get clean, typed, tested code with edge cases handled.
Write unit tests for the function below. Language: [language] Testing framework: [e.g. Jest, pytest, PHPUnit, JUnit] Cover: - Typical inputs (happy path) - Edge cases: empty, zero, null/None, very large values, unusual characters - Invalid inputs and expected errors - Any branches or conditions in the code Rules: - On…
Write unit tests for any function
Generate thorough unit tests that cover normal cases, edge cases and errors, using your testing framework of choice.