Skip to content

mycalldev/unit-testing

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pair programming exercise

  • Write a solution to each exercise and a corresponding test which ensures correctness of solution
  • Try to write the test before writing the solution. This will force you to think closely about the task
  • One person should be writing the test and another the solution. Alternate roles after each exercise
  • For some tests you may have to write several test cases to make sure all edge cases are covered
  • Run npm test regularly to ensure your tests pass
  • Commit and push after each solution created
  • Create a pull request after first push
  • camelise - Write a function which receive a string of lower case, space separated words. It should convert the string to camel case. That is capitalise the first letter of every word except the first and remove all spaces
  • merging - Write a function which receives an array of objects. It should merge them into a single object. The objects with fewest values should take precedence over objects with fewer values. The input objects should remain unaffected, by the merge. For example input [{a: 5}, {a: 3, b: 21, c:32}] to {a:5, b:21, c:32}
  • possibleValues - Write a function which receives an array of objects. Your function should output an object which contains all the keys from input objects. The corresponding value of each key should be an array which contains a list of all values the corresponding key had in all input objects. Values should be unique. For example [{a: 5}, {a: 3, b: 21, c:32}, {a: 3, c:32}] to {a:[5,3], b:[21], c:[32]}
  • isPrime - Write a function which receives an integer an returns true if the input is a prime number, false otherwise
  • walkabout - write a constructor called Walker. It should receive one parameter, a string which is either 'N', 'S', 'E' or 'W' which indicates the direction the walker is facing. Walker's initial coordinates should be (0,0), where the first coordinate represents the x coordinate (horizontal) and the second coordinate represents y coordinate (vertical).
  • Add a walk method to Walker using its prototype which accepts a direction as a string and a number representing the number of steps to be taken. When called the walker should update its coordinates and add the move made to its journey history. The journey history should be stored using coordinates representing the location at the end of each move.
  • Add a pathTaken method to Walker using its prototype. It should output the journey taken taken as a list of coordinates

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 53.1%
  • HTML 25.3%
  • CSS 21.6%