chore: update .gitignore and improve coding standards documentation
- Added .cursor/sessions/* to .gitignore to prevent session files from being tracked. - Enhanced coding standards in SKILL.md by adding semicolons to TypeScript examples for consistency. - Improved formatting in continuous learning, detail layout, and other SKILL.md files for better readability. These changes aim to streamline development processes and maintain code quality across the project.
This commit is contained in:
@@ -38,31 +38,31 @@ TDD for this frontend monorepo (Vitest, not NestJS/Supertest).
|
||||
## Unit example
|
||||
|
||||
```typescript
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { createFullPageSchema } from './full-page.validator'
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { createFullPageSchema } from './full-page.validator';
|
||||
|
||||
describe('createFullPageSchema', () => {
|
||||
const t = (key: string) => key
|
||||
const t = (key: string) => key;
|
||||
|
||||
it('rejects an empty code', () => {
|
||||
const result = createFullPageSchema(t).safeParse({ code: '', name: 'Widget' })
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
const result = createFullPageSchema(t).safeParse({ code: '', name: 'Widget' });
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## Component example
|
||||
|
||||
```tsx
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
it('calls onClick', async () => {
|
||||
const onClick = vi.fn()
|
||||
render(<Button onClick={onClick}>Save</Button>)
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Save' }))
|
||||
expect(onClick).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
const onClick = vi.fn();
|
||||
render(<Button onClick={onClick}>Save</Button>);
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Save' }));
|
||||
expect(onClick).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
```
|
||||
|
||||
## Mocking
|
||||
@@ -72,7 +72,7 @@ Mock `@repo/core-api` and `apiClient`, not a database.
|
||||
```ts
|
||||
vi.mock('@repo/core-api/http-client', () => ({
|
||||
createHttpClient: () => ({ get: vi.fn(), post: vi.fn(), put: vi.fn(), delete: vi.fn() }),
|
||||
}))
|
||||
}));
|
||||
```
|
||||
|
||||
## File organization
|
||||
|
||||
Reference in New Issue
Block a user