Skip to main content
Glama
mlaurel

Structured Workflow Engine MCP Server

by mlaurel
write-unit-tests.mdβ€’2.76 kB
# Write Unit Tests Prompt (v1) ## 🎯 Goal Create high-quality unit tests that effectively validate functionality and improve code coverage. ## πŸ“₯ Context (ask if missing) 1. **Test Plan** – prioritized list of functions to test, testing approach 2. **Target Functions** – specific modules/functions requiring test coverage 3. **Test Environment** – framework setup, testing utilities available 4. **Existing Test Patterns** – current conventions, mocking strategies ## 🚦 Skip if - All planned tests already implemented or emergency fixes that don't require testing ## πŸ” Checklist - **Test Structure & Organization** - [ ] Create test files following project conventions - [ ] Group related tests in logical describe blocks - [ ] Use clear, descriptive test names - [ ] Follow Arrange-Act-Assert (AAA) pattern - **Test Coverage Implementation** - [ ] Test happy path scenarios - [ ] Cover edge cases and boundary conditions - [ ] Test error handling and exception scenarios - [ ] Validate input/output transformations - **Mocking & Isolation** - [ ] Mock external dependencies appropriately - [ ] Use dependency injection for testability - [ ] Isolate units from side effects - [ ] Mock asynchronous operations properly - **Test Quality & Maintainability** - [ ] Make tests readable and self-documenting - [ ] Avoid test interdependencies - [ ] Use appropriate assertions - [ ] Keep tests focused and atomic ## πŸ“€ Output **Test Files:** Following project structure (e.g., `__tests__/`, `*.test.js`, `*.spec.ts`) Each test file should include: 1. **Setup/Teardown** – proper test environment preparation 2. **Test Cases** – comprehensive coverage of functionality 3. **Mocks/Stubs** – isolated external dependencies 4. **Assertions** – clear validation of expected behavior 5. **Documentation** – comments for complex test logic ## πŸ§ͺ Test Types & Patterns - **Pure Function Tests**: Input β†’ Function β†’ Expected Output - **State Change Tests**: Initial State β†’ Action β†’ Expected State - **Error Handling Tests**: Invalid Input β†’ Function β†’ Expected Error - **Async Tests**: Promise/Callback β†’ Function β†’ Resolved Value - **Mock Integration Tests**: Service β†’ Mocked Dependency β†’ Expected Interaction ## ⚑ Best Practices - **Test Naming**: `should [expected behavior] when [condition]` - **Test Data**: Use descriptive test data, avoid magic numbers - **Assertions**: Use specific assertions (toBe, toEqual, toContain) - **Performance**: Keep tests fast, avoid unnecessary delays - **Reliability**: Make tests deterministic and repeatable ## ➑️ Response Flow Select function β†’ Analyze behavior β†’ Write test cases β†’ Implement mocks β†’ Validate coverage

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mlaurel/mcp-workflow-engine'

If you have feedback or need assistance with the MCP directory API, please join our Discord server