/numbers-and-strings-testing

Testing With Mocha/Chai

Primary LanguageJavaScript

Setup

  • fork and clone this repo
  • npm install
  • run your tests by running mocha from the command line

Docs

Part 1: Numbers functions

  • in your numbers-tests.js write tests for the following functions:
    • add (this is already provided to you as an example)
    • filterEvens takes an array (that could include any data type) and returns an array of only the even numbers
    • secondSmallest returns the second smallest number in an array
    • uniqueNums takes an array of numbers and returns only the unique numbers
  • try running your tests. they should all fail at this point.
  • complete the functions in the js/numbers-funcs.js file, one a time
  • after you complete each function import it into your test file
  • run your tests to make sure your solution is correct

Part 2: Strings functions

  • in your strings-tests.js write tests for the following functions:
    • capitalize (this is already provided to you as an example)
    • capitalizeFirst takes an array of strings and returns a new string with the first letter of each string capitalized
    • OsToZeros takes a string and returns a new string with all of the letter O's changed to the number 0
    • countTheLetters takes a string and returns an object with a count of the letters that appear in the string
  • try running your tests. they should all fail at this point.
  • complete the functions in the js/strings-funcs.js file, one a time
  • after you complete each function import it into your test file
  • run your tests to make sure your solution is correct