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
minimize complexity in tests
Forhad Hosainb313aeed83af
diff --git a/packages/runtime/package.json b/packages/runtime/package.jsonindex 4a743a5b..c5e44b40 100644--- a/packages/runtime/package.json+++ b/packages/runtime/package.json@@ -48,8 +48,7 @@"typescript": "^5.0.0","vite-tsconfig-paths": "^5.1.2","vitest": "^2.1.4",- "supertest": "^6.3.3",- "@vitest/coverage-v8": "^2.1.4"+ "supertest": "^6.3.3"},"dependencies": {"@modelcontextprotocol/sdk": "^1.10.1",@@ -65,6 +64,7 @@"multer": "^1.4.5-lts.1","openai": "^4.72.0","openapi-to-postmanv2": "^4.24.0",+ "pkce-challenge": "^5.0.0","swagger-ui-express": "^5.0.0","uuid": "^9.0.1"},diff --git a/packages/runtime/tests/README.md b/packages/runtime/tests/README.mdindex 657e3d1e..eb1bd19e 100644--- a/packages/runtime/tests/README.md+++ b/packages/runtime/tests/README.md@@ -13,7 +13,7 @@ tests/│ ├── utils/ # Utility function tests│ └── middlewares/ # Middleware tests├── services/ # Service tests-└── integration/ # API tests+└── integration/ # API integration tests (using supertest)```## Running Tests@@ -24,14 +24,12 @@ pnpm test# Watch modepnpm test:watch--# Coverage report-pnpm test:coverage```## Writing Tests - KISS Approach### Keep It Simple+```typescriptdescribe('MyFunction', () => {it('handles valid input', () => {@@ -47,6 +45,7 @@ describe('MyFunction', () => {```### Mock Only What You Need+```typescriptvi.mock('@smythos/sre', () => ({Logger: vi.fn(() => ({ error: vi.fn() })),@@ -54,14 +53,16 @@ vi.mock('@smythos/sre', () => ({```### Test One Thing at a Time+- Each test should verify one behavior- Use descriptive test names- Follow Arrange-Act-Assert pattern-## Coverage Goals-- **Target**: 70% overall coverage-- Focus on critical paths, not 100% coverage+## Testing Philosophy++- Focus on critical paths and business logic- Quality over quantity+- Test behavior, not implementation details## Best Practices@@ -80,12 +81,9 @@ it('processes valid requests', async () => {expect(result.status).toBe('success');});-// Simple API test+// API integration test with supertestit('returns health status', async () => {- await request(app)- .get('/health')- .expect(200)- .expect({ status: 'ok' });+ await request(app).get('/health').expect(200).expect({ status: 'ok' });});```@@ -96,4 +94,4 @@ it('returns health status', async () => {3. Verify async operations are awaited4. Ensure test isolation (no shared state)-Keep tests simple, focused, and valuable.\ No newline at end of file+Keep tests simple, focused, and valuable.diff --git a/packages/runtime/tests/integration/api.test.ts b/packages/runtime/tests/integration/api.test.tsindex 15be8783..0dd19a1e 100644--- a/packages/runtime/tests/integration/api.test.ts+++ b/packages/runtime/tests/integration/api.test.ts@@ -1,9 +1,9 @@/*** Simple API integration tests*/-import { describe, it, expect, vi } from 'vitest';-import request from 'supertest';import express from 'express';+import request from 'supertest';+import { describe, it } from 'vitest';describe('API Integration', () => {const createTestApp = () => {diff --git a/packages/runtime/vitest.config.ts b/packages/runtime/vitest.config.tsindex f59b659b..0d778522 100644--- a/packages/runtime/vitest.config.ts+++ b/packages/runtime/vitest.config.ts@@ -1,5 +1,5 @@-import { defineConfig } from 'vitest/config';import tsconfigPaths from 'vite-tsconfig-paths';+import { defineConfig } from 'vitest/config';export default defineConfig({plugins: [tsconfigPaths()],@@ -8,12 +8,6 @@ export default defineConfig({environment: 'node',include: ['tests/**/*.test.ts'],exclude: ['node_modules'],- coverage: {- reporter: ['text', 'text-summary', 'html'],- reportsDirectory: './coverage',- include: ['src/**/*.{ts,tsx}'],- exclude: ['node_modules'],- },testTimeout: 30_000,},