Module quiz: Testing :Programming with JavaScript (Meta React Native Specialization) Answers 2025
1. Which is a unit testing framework?
✔️ Jest
❌ JFrame
❌ JavaFrame
❌ JavaTest
2. Test result?
function multiply(a, b) { return a; }
expect(multiply(2, 2)).toBe(4);
✔️ Fail
❌ Success
(Because it returns a instead of a * b)
3. End-to-end testing is slowest & most expensive.
✔️ True
❌ False
4. What is Code Coverage?
✔️ A measure of what percentage of your code is covered by tests.
❌ Percentage failing tests
❌ Percentage complete
❌ Percentage written in JS
5. Node.js led to ability to do what?
✔️ Write full-stack JavaScript programs
❌ Estimate code coverage
❌ Run unit tests
❌ Download packages
6. NOT one of the three types of testing?
✔️ Post-hoc testing
❌ Unit testing
❌ Integration testing
❌ End-to-end testing
7. What is npm used for?
✔️ Use many libraries/frameworks as Node.js modules
❌ Add code from StackOverflow
❌ Build backend
❌ Test coverage
8. File listing required node packages?
✔️ package.json
❌ node.json
❌ npm.json
❌ pkg.json
9. Non-coder wants to help with testing. Which test?
✔️ End-to-end testing
❌ Unit testing
❌ Integration testing
❌ Post-hoc testing
10. Best way to separate code from dependencies?
✔️ Mocking
❌ End-to-end testing
❌ module.exports
❌ Fakes
✅ Summary Table
| Q.No | Correct Answer | Short Explanation |
|---|---|---|
| 1 | Jest ✔️ | Common JS testing framework. |
| 2 | Fail ✔️ | Function returns wrong value. |
| 3 | True ✔️ | E2E tests are slow & costly. |
| 4 | Code covered by tests ✔️ | Measures tested code % |
| 5 | Full-stack JS ✔️ | Node enables JS backend too. |
| 6 | Post-hoc testing ✔️ | Not a real test category. |
| 7 | Use Node modules ✔️ | npm manages packages. |
| 8 | package.json ✔️ | Stores all dependencies. |
| 9 | End-to-end testing ✔️ | Non-devs can run functional tests. |
| 10 | Mocking ✔️ | Replaces dependencies in tests. |