At least 10 questions — mix of concept, syntax, practical, and logic. Score ≥80% (enforced by the API) to save progress.
15 questions · concept 5 · syntax 3 · practical 4 · logic 3
1. How does this course teach Nest testing discipline? Concept
Write your own assertions inside @repo/notes-milestones to match your code Use the read-only @repo/notes-milestones grader plus Nest testing docs — implement until green Rely on TypeScript compilation plus manual clicking to confirm behavior Assert only 200 responses and let the guards cover the error paths
2. Why keep the grader read-only? Syntax
Editing the grader per learner keeps the checks relevant to their code A failing assertion usually signals a stale check, not a real bug Read-only files run faster in CI than editable ones Moving goalposts hides real regressions
3. What should HTTP tests assert? Practical
Only the status code, since the body shape is a TypeScript concern The exact response timing to catch slow endpoints Status codes and meaningful body contracts That the controller method was called, using a spy
4. Is compile success enough to skip status asserts? Logic
Yes — a compiling controller returns its decorated @HttpCode status Yes — as long as an e2e test hits the route once Yes — DTO validation guarantees the correct status No — wrong statuses can still compile
5. Why use Nest testing utilities? Concept
They spin up the real database so every test is a full e2e run They mock the network layer so no controllers are ever invoked They auto-generate assertions from the DTO definitions Override providers and exercise controllers/services in isolation or e2e
6. What is wrong with production console.log-only verification? Practical
It only logs status codes, never the response bodies It requires a live broker so it cannot run locally It passes silently whenever TypeScript compiles Not reproducible, not automated, easy to miss regressions
7. When a milestone check fails, what should you do? Syntax
Loosen the failing assertion until it matches your current output Add a skip flag to the failing check and revisit it later Rerun the grader until a flaky pass lets you move on Fix notes-practice implementation to meet the contract
8. What do milestone packages encode? Logic
Suggested code snippets learners copy into notes-practice A grading rubric expressed as human-readable documentation Environment variables the practice app needs at runtime Acceptance checklists as executable assertions
9. Should learners skip Unauthorized/Forbidden assertions? Concept
No — auth paths are part of correctness Yes — the RolesGuard already guarantees those responses Yes — 401 and 403 are framework defaults, not app logic Yes — once the happy path passes, the error codes follow
10. Which testing shortcut is wrong? Practical
Changing failing checks in packages/notes-milestones as a learner shortcut Implementing the app until every check passes Asserting HTTP status codes in e2e tests Following the Nest testing documentation patterns
11. What does this testing setup enable? Concept intermediate
const module = await Test.createTestingModule({
providers: [
NotesService,
{ provide: getRepositoryToken(Note), useValue: mockRepo },
],
}).compile();Testing NotesService with a mocked repository, no live database Testing the NotesController end-to-end with a real HTTP server Running NotesService against an in-memory SQLite database Auto-mocking every provider in the NotesModule at once
12. What contract does this e2e test protect? Syntax advanced
await request(app.getHttpServer())
.get('/notes')
.expect(401);That unauthenticated list requests return 401 That members without the admin role receive 401 That the list route returns a { data, meta } body That an expired token is refreshed before the list loads
13. Why override the publisher in tests? Practical intermediate
.overrideProvider(NotesEventsPublisher)
.useValue({ publish: jest.fn() })To assert publish was called without a real broker To route real events through RabbitMQ during the test run To make the publisher throw so the create path is tested To replace the service so no note is actually saved
14. A read-only milestone check like this fails. What should a learner do? Logic advanced
// packages/notes-milestones/checks.ts (read-only)
expect(res.status).toBe(403);Relax the assertion to accept either 200 or 403 Fix the notes-practice implementation until the check passes Add a jest skip so the suite goes green Copy the expected status from the grader into a controller comment
15. What does this assertion verify? Concept intermediate
expect(res.body).toEqual({
data: expect.any(Array),
meta: expect.objectContaining({ total: expect.any(Number) }),
});That meta.total equals the number of items in data That the data array is sorted by creation date The list response follows the { data, meta } contract That the response status code is 200
Submit quiz Checking your session…