SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
SmythOS Runtime Server - Test Suite
Simple, focused tests following KISS principle and OSS best practices.
Test Structure
tests/
├── setup.ts # Simple test utilities
├── mocks/
│ └── sre.mock.ts # Basic SRE library mocks
├── core/
│ ├── utils/ # Utility function tests
│ └── middlewares/ # Middleware tests
├── services/ # Service tests
└── integration/ # API integration tests (using supertest)
Running Tests
# Run all tests
pnpm test
# Watch mode
pnpm test:watch
Writing Tests - KISS Approach
Keep It Simple
describe('MyFunction', () => {
it('handles valid input', () => {
const result = myFunction('input');
expect(result).toBe('output');
});
it('handles edge cases', () => {
expect(myFunction('')).toBe(null);
expect(myFunction(null)).toBe(null);
});
});
Mock Only What You Need
vi.mock('@smythos/sre', () => ({
Logger: vi.fn(() => ({ error: vi.fn() })),
}));
Test One Thing at a Time
- Each test should verify one behavior
- Use descriptive test names
- Follow Arrange-Act-Assert pattern
Testing Philosophy
- Focus on critical paths and business logic
- Quality over quantity
- Test behavior, not implementation details
Best Practices
- Simple is better than complex
- Test behavior, not implementation
- Mock external dependencies only
- Use realistic test data
- Keep tests fast and independent
Common Patterns
// Simple service test
it('processes valid requests', async () => {
const result = await service.process(validInput);
expect(result.status).toBe('success');
});
// API integration test with supertest
it('returns health status', async () => {
await request(app).get('/health').expect(200).expect({ status: 'ok' });
});
When Tests Fail
- Read the error message carefully
- Check your mocks are set up correctly
- Verify async operations are awaited
- Ensure test isolation (no shared state)
Keep tests simple, focused, and valuable.