Changed test library to mocha and refactored the implementation

When the testla library was added as a dependency there was a circular dependency issue. Testla uses get-parameter-names. I changed the testing library to mocha and wrote new tests and also refactored the code so it is hopefully easier to follow. The only new behaviour of this snippet is that get-parameter-names throws an exception if a function isn't provided.