You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: Fix missing coverage from new introduced code
- Add a reusable router agent test utility and replace all
supertest-dependent suites with in-memory request execution so tests
run without socket permissions.
- Expand helper and controller specs (including multi-domain and
watchlist error paths)
- Build new targeted suites, and rework mocks to exercise every branch
required for full coverage.
-`api/index.ts` boots the Express server and wires middleware; domain logic sits in `controllers/`, `routes/`, `models/`, and `middleware/` to keep concerns isolated.
5
+
- Configuration lives in `config/` with environment-driven exports; shared utilities extend `helpers/` and TypeScript declarations in `types/`.
6
+
- UI assets are split between `views/` (EJS templates and partials such as `views/partials/card-add.ejs`) and `public/` for static files.
7
+
- Data and ops artefacts live in `migrations/`, `docs/`, `system/`, and automated checks under `tests/e2e` and `tests/integration`.
8
+
9
+
## Build, Test & Development Commands
10
+
-`yarn start` launches the production server through `tsx api/index.ts`; use `yarn start:dev` for watch mode with source maps.
11
+
-`yarn lint` performs TypeScript type-checking plus `npx ejslint` over templates; run `yarn lint:ts` or `yarn lint:ejs` to isolate either track.
12
+
-`yarn db:migrate` and `yarn db:rollback` apply or revert Mongo migrations in `migrations/`; check current state with `yarn db:status`.
13
+
-`yarn test` runs the Jest suite; add `:coverage` to emit reports into `coverage/` and update `junit.xml` for CI.
14
+
15
+
## Coding Style & Naming Conventions
16
+
- TypeScript files use 2-space indentation, trailing commas, and TSDoc-style blocks (`/** ... */`) for exported members as seen in `controllers/`.
17
+
- Prefer `camelCase` for functions/variables, `PascalCase` for classes and interfaces, and `kebab-case` for EJS partial filenames.
18
+
- Keep logic pure in controllers/helpers; place request wiring in routes; export a single default per module when practical.
19
+
20
+
## Testing Guidelines
21
+
- Tests run on Jest with the `ts-jest` preset; name specs `*.spec.ts` or `*.test.ts` under `tests/` to match `jest.config.js`.
22
+
- Aim to maintain coverage across `api`, `config`, `controllers`, `helpers`, `middleware`, `models`, and `routes` as enforced by `collectCoverageFrom`.
23
+
- Consume supertest for request flows and prefer fixture factories over network calls; refresh snapshots after intentional UI changes.
24
+
25
+
## Commit & Pull Request Guidelines
26
+
- Follow the observed Conventional Commit style (`feat:`, `refactor:`, `fix:`, `yarn:`) with concise, imperative summaries under ~70 characters.
27
+
- Group related changes per commit; include migration IDs or view names when helpful.
28
+
- Pull requests should link issues, describe behavioural impact, list validation commands (`yarn test`, `yarn db:migrate`), and attach UI screenshots for template updates.
29
+
30
+
## Security & Configuration Tips
31
+
- Never commit `.env`; update `.env.example` when introducing new settings and document defaults in `config/`.
32
+
- Rotate API keys when sharing recordings or tests, and prefer local `.env.test` overrides for automation to avoid polluting development data.
0 commit comments