ENع
الدرس 27 · JavaScript beyond the browser

Testing JavaScript

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

A unit test is code that calls your code with inputs whose answers you know, and checks the result with an assertion. Follow Node.js's built-in test runner through a real discount function: one test passes, the second throws an AssertionError that exposes a bug, the run ends with exit code 1, and a one-line fix turns everything green.

11 دقيقة11 خطوات5 أسئلةAdvanced
شكل 27 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.