Refactored test to use mockery instead of sinon