adding tests around promises
code reuse refactor
more tests