/W08D01HW

Primary LanguageJavaScript

Jest HW

Jest Cheat Sheet

  1. Sum , toBe Jest Global Methods
    • Write a function that will accept any number of argument:
      • Return the sum for all that numbers.
      • If there is no parameter passed to it then return 0.
    • Write a test that will show all cases to test the sum function, such as pass 0 parameter, 1, 2, 3 ,4...., (hint: use reduce)
  2. Filter, toBe Jest Global Methods
    • Write a function that will accept String and check:
      • If the string is empty then return "Unknown".
      • If the string passed with white space return it with no space.
      • If the length of string passed more than 10 return only the first 10 characters.
      • If the string passed started with underscore return it without underscore.
    • Write a test that will show all cases to test the function