Agent skill
testing-tdd-london-example-1-service-orchestration-test
Sub-skill of testing-tdd-london: Example 1: Service Orchestration Test (+2).
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/_archive/development/testing/testing-tdd-london/example-1-service-orchestration-test
SKILL.md
Example 1: Service Orchestration Test (+2)
Example 1: Service Orchestration Test
describe('Service Collaboration', () => {
let mockServiceA: jest.Mocked<ServiceA>;
let mockServiceB: jest.Mocked<ServiceB>;
let mockServiceC: jest.Mocked<ServiceC>;
let orchestrator: ServiceOrchestrator;
beforeEach(() => {
mockServiceA = {
prepare: jest.fn().mockResolvedValue({ data: 'prepared' })
};
mockServiceB = {
process: jest.fn().mockResolvedValue({ result: 'processed' })
};
mockServiceC = {
finalize: jest.fn().mockResolvedValue({ status: 'complete' })
};
orchestrator = new ServiceOrchestrator(
mockServiceA,
mockServiceB,
mockServiceC
);
});
it('should coordinate dependencies in correct order', async () => {
await orchestrator.execute(task);
// Verify coordination sequence
expect(mockServiceA.prepare).toHaveBeenCalledBefore(mockServiceB.process);
expect(mockServiceB.process).toHaveBeenCalledBefore(mockServiceC.finalize);
// Verify data flow between services
expect(mockServiceB.process).toHaveBeenCalledWith(
expect.objectContaining({ data: 'prepared' })
);
expect(mockServiceC.finalize).toHaveBeenCalledWith(
expect.objectContaining({ result: 'processed' })
);
});
});
Example 2: Error Handling Verification
describe('Error Handling', () => {
it('should handle repository failure gracefully', async () => {
const mockRepository = {
save: jest.fn().mockRejectedValue(new Error('Connection failed'))
};
const mockLogger = {
error: jest.fn()
};
const mockRetry = {
attempt: jest.fn().mockResolvedValue(false)
};
const service = new UserService(mockRepository, mockLogger, mockRetry);
await expect(service.register(userData)).rejects.toThrow('Registration failed');
// Verify error handling interactions
expect(mockLogger.error).toHaveBeenCalledWith(
'Repository save failed',
expect.objectContaining({ error: expect.any(Error) })
);
expect(mockRetry.attempt).toHaveBeenCalledTimes(3);
});
});
Example 3: Swarm Coordination Testing
describe('Swarm Test Coordination', () => {
let swarmCoordinator: SwarmCoordinator;
beforeAll(async () => {
// Signal other swarm agents
await swarmCoordinator.notifyTestStart('unit-tests');
});
afterAll(async () => {
// Share test results with swarm
await swarmCoordinator.shareResults(testResults);
});
it('should share mock contracts across swarm', () => {
const sharedMocks = {
userRepository: createSwarmMock('UserRepository', {
save: jest.fn(),
findByEmail: jest.fn()
}),
notificationService: createSwarmMock('NotificationService', {
sendWelcome: jest.fn()
})
};
// Other swarm agents can verify against these contracts
swarmCoordinator.publishContracts(sharedMocks);
});
});
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?