PromptsVault AI is thinking...
Searching the best prompts from our community
Searching the best prompts from our community
Prompts matching the #unit-testing tag
Write a set of unit tests for the following JavaScript function, which takes an array of numbers and returns the sum. Use a testing framework like Jest. Cover edge cases like an empty array, an array with non-numeric values, and a very large array.
Write effective unit tests with Vitest. Practices: 1. describe/it blocks for test organization. 2. expect assertions with matchers. 3. Mock functions with vi.fn() and vi.spyOn(). 4. Component testing with @testing-library/react. 5. Coverage reporting with c8. 6. Snapshot testing for UI components. 7. Setup/teardown with beforeEach/afterEach. 8. Test.concurrent for parallelization. Use in-source testing for co-location and implement custom matchers for domain logic.