refactor test to use sinon