Module 46: Backend Testing

Lesson 1 of 5 · 15–25 minutes

What to test in a backend

🏠The everyday picture

A car factory tests the brakes on their own, then the whole braking system fitted to a car, then takes the finished car for a test drive. Each level catches different problems.

📘What it really is

🖱️Try it

Install Vitest in enquiries-api. List, in a TESTING.md, the rules and permissions your API must enforce (for example "only admins can delete", "closed enquiries can't be closed again", "signed-out requests get 401"). These are the tests you'll write in this module.

✅Quick check

Which tests should there be most of, and why?

Show the answer

Unit tests: they're fast and pinpoint exactly what broke.

Why are permission tests so important?

Show the answer

A missing permission check lets people see or change data they shouldn't, often without anyone noticing.

← BackModule 46
ProLearners Assist