LiorCohen/sdd / plugin/fullstack-typescript/skills/components/integration-testing/integration-testing-standards
integration-testing-standards
VerifiedIntegration testing patterns - database setup/teardown, API testing, contract testing, and Testkube execution.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.1 KB |
| resources/api-testing.md | markdown | 4.4 KB |
| resources/authentication.md | markdown | 1.9 KB |
| resources/database-strategies.md | markdown | 3.2 KB |
| resources/testkube.md | markdown | 1.5 KB |
resources/authentication.md
View on GitHub# Authentication
Login helpers and protected endpoint test patterns for integration tests.
---
## Login Helper
```typescript
// components/<testing-component>/tests/integration/helpers/auth.ts
import { TestClient } from './client';
export interface AuthenticatedUser {
token: string;
user: { id: string; email: string; role: string };
}
export const loginAsTestUser = async (
client: TestClient,
credentials = { email: 'test@example.com', password: 'TestPass123!' }
): Promise<AuthenticatedUser> => {
const response = await client.post('/api/auth/login', credentials);
if (response.status !== 200) {
throw new Error(`Login failed: ${JSON.stringify(response.data)}`);
}
client.setAuthToken(response.data.data.token);
return {
token: response.data.data.token,
user: response.data.data.user,
};
};
export const createAndLoginUser = async (
client: TestClient,
userData: { email: string; name: string; role: string; password: string }
): Promise<AuthenticatedUser> => {
// Create user
await client.post('/api/users', userData);
// Login
return loginAsTestUser(client, {
email: userData.email,
password: userData.password,
});
};
```
---
## Protected Endpoint Tests
```typescript
describe('Protected endpoints', () => {
it('returns 401 without authentication', async () => {
const response = await client.get('/api/plans');
expect(response.status).toBe(401);
expect(response.data.error.code).toBe('unauthorized');
});
it('returns 403 for insufficient permissions', async () => {
// Login as viewer (read-only role)
await createAndLoginUser(client, {
email: 'viewer@test.com',
name: 'Viewer',
role: 'viewer',
password: 'ViewerPass123!',
});
// Try to create (requires planner role)
const response = await client.post('/api/plans', { name: 'New Plan' });
expect(response.status).toBe(403);
expect(response.data.error.code).toBe('forbidden');
});
});
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |