C. Using arrow function instead of regular function.
D. Missing import of assertEquals function.
Solution
Step 1: Check for imports
The code uses assertEquals but does not import it from Deno's standard library.
Step 2: Understand impact
Without importing, assertEquals is undefined, causing a runtime error.
Final Answer:
Missing import of assertEquals function. -> Option D
Quick Check:
assertEquals must be imported [OK]
Hint: Always import assertion functions before use [OK]
Common Mistakes:
Assuming assertEquals is globally available
Thinking arrow functions cause errors here
Ignoring missing import errors
5. You want to write multiple tests in Deno that share setup code. Which approach best uses Deno's built-in testing to simplify this?
hard
A. Repeat the setup code inside every Deno.test block manually.
B. Use a third-party testing library to manage setup and teardown.
C. Write a helper function for setup and call it inside each Deno.test block.
D. Put all tests inside one big Deno.test block without separation.
Solution
Step 1: Understand Deno's testing features
Deno.test allows multiple test blocks but does not have built-in setup/teardown hooks like some libraries.
Step 2: Choose best practice for shared setup
Writing a helper function for setup and calling it inside each test keeps code clean and avoids repetition.
Step 3: Evaluate other options
Repeat the setup code inside every Deno.test block manually. repeats code, which is inefficient. Use a third-party testing library to manage setup and teardown. adds complexity by using external libraries. Put all tests inside one big Deno.test block without separation. mixes tests, reducing clarity.
Final Answer:
Write a helper function for setup and call it inside each Deno.test block. -> Option C
Quick Check:
Helper function for setup = clean, reusable tests [OK]
Hint: Use helper functions to share setup code in tests [OK]
Common Mistakes:
Copy-pasting setup code in every test
Relying on external libraries unnecessarily
Combining all tests in one block
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.