Exercise 3: Testing computeFullPath() — Possible Solution ==================================================================== THE FUNCTION UNDER TEST ------------------------------ async function computeFullPath(pool, slug, parentId) { if (!parentId) return slug; const [rows] = await pool.query('SELECT full_path FROM pages WHERE id = ?', [parentId]); return `${rows[0].full_path}/${slug}`; } TEST 1 — A ROOT PAGE ------------------------------ await computeFullPath(pool, 'programming', null); // resolves to 'programming' The early return fires immediately since parentId is null - no query is issued to the database at all. TEST 2 — A NESTED PAGE ------------------------------ Given a page already stored with id: 1 and full_path: 'programming': await computeFullPath(pool, 'java', 1); // resolves to 'programming/java' The parameterized query fetches that row's own full_path, and the new page's slug is appended to it with a single slash. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly traces both branches of computeFullPath() - the no-parent early return and the real-parent parameterized query - and correctly shows the resulting full_path value each one produces.