opensearch-project/agent-health/write-test

Claude Code and agent skill by opensearch-project/agent-health

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Write tests for Agent Health following project conventions. Use when adding tests for new features, bug fixes, or improving coverage. Covers Jest setup, mocking patterns, path aliases, and coverage thresholds.

Install

npx vskill@latest install opensearch-project/agent-health/write-test

SKILL.md

Write Tests for Agent Health

You are helping the user write tests following Agent Health's conventions.

Test Structure

  • Tests live in tests/ mirroring the source directory structure
  • Jest config: jest.config.cjs
  • Always use `@/` path alias — never relative imports
typescript
// ✅ Correct
import { myFunction } from '@/services/myService';
// ❌ Wrong
import { myFunction } from '../../services/myService';

Test File Template

typescript
/* Copyright OpenSearch Contributors
SPDX-License-Identifier: Apache-2.0 */
import { functionUnderTest } from '@/path/to/module';
describe('functionUnderTest', () => {
beforeEach(() => {
jest.clearAllMocks();
});
it('should handle the happy path', () => {
const result = functionUnderTest(validInput);
expect(result).toEqual(expectedOutput);
});
it('should handle edge case', () => {
// ...
});
});

Mocking Patterns

Mock External Services (OpenSearch, Bedrock)
typescript
jest.mock('@/server/adapters/opensearch/StorageModule', () => ({
getStorageModule: () => ({
testCases: {
create: jest.fn().mockResolvedValue({ id: 'test-1', name: 'Test' }),
get: jest.fn().mockResolvedValue(null),
},
}),
}));
Mock Fetch/HTTP
typescript
const mockFetch = jest.fn().mockResolvedValue({
ok: true,
json: () => Promise.resolve({ data: 'result' }),
});
global.fetch = mockFetch;
Don't Mock Internal Modules

Test through the public API. Only mock at system boundaries.

Integration Tests

If the test creates data in OpenSearch or starts a server:

typescript
afterEach(async () => {
// Clean up created resources
await storage.delete(createdId);
});
afterAll(async () => {
// Close connections
await server.close();
});

Coverage Thresholds

MetricMinimum
Lines90%
Statements90%
Functions80%
Branches80%

Run coverage: npm test -- --coverage

Running Tests

bash
npm test # All tests
npm run test:unit # Unit only
npm run test:integration # Integration only
npm test -- path/to/file.test.ts # Single file
npm test -- --watch # Watch mode

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
35
Repository forks
28
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/opensearch-project/agent-health/write-test/badge)](https://verified-skill.com/skills/opensearch-project/agent-health/write-test)

Something wrong with this skill or its page? Tell us.