EduFlow
Testing JavaScript Apps

Final assessment

Twelve questions across the whole course. Score 70% or more to pass and unlock your certificate. You can retake it as often as you like.

Finish every lesson to earn the certificate — you can take the assessment any time.

Question 1 of 12

A form parses the amount and sends it through an API client. Which test gives the most confidence per minute of CI for that form?

Question 2 of 12

What is the main problem with this test?

JavaScript
test('withTip', () => {
  expect(withTip(2000, 15).tipCents).toBe(300);
  expect(() => withTip(2000, -1)).toThrow();
  expect(withTip(2000, 0).totalCents).toBe(2000);
});
Question 3 of 12

A group must have between 2 and 12 members. Which inputs test the rule best?

Question 4 of 12

await expect(loadGroup('x', fetchMock)).rejects.toThrow() passes both for the correct code and for a version that crashes with a TypeError before it checks the status. How do you make the test meaningful?

Question 5 of 12

Tests pass one by one but fail in the full run. An earlier test does vi.spyOn(Math, 'random').mockReturnValue(0). What is the fix?

Question 6 of 12

An icon-only button is rendered as <button aria-label="Delete expense"><svg>…</svg></button>. Which query should a Testing Library test use?

Question 7 of 12

A “Saved” toast appears after saving and disappears a moment later. How do you assert that it disappears?

Question 8 of 12

This Playwright check fails now and then in CI. What is the fix?

TypeScript
const rows = await page.getByRole('listitem').all();
expect(rows.length).toBe(3);
Question 9 of 12

End-to-end tests share one seeded group, and one of them deletes an expense from it. Other tests fail depending on the order. What is the best fix?

Question 10 of 12

Which tool tells you that no test would notice if a < in your code became <=?

Question 11 of 12

Pull requests keep getting merged while the end-to-end job is red. What is the right fix?

Question 12 of 12

A component test mocks your own pure formatMoney so it always returns 'X'. What is the best change?

12 questions unanswered