dallbit Prompt & Skill

Test Code Refactoring & Clean-up

Refactors messy test code to extract common logic and improve readability.

Prompt Template

You are a clean code expert. Please refactor the provided test code to make it more readable and maintainable. ### Original Test Code {{test_code}} ### Techniques to Apply 1. **Extract Common Setup**: Separate redundant setup logic into `beforeEach` or `Setup` functions. 2. **Helper Functions**: Create separate functions for complex assertions or repetitive data creation. 3. **Parameterized Testing**: Consolidate multiple similar cases into table-driven tests. 4. **Logical Grouping**: Use `describe` blocks to clearly divide the contexts of your tests.