Correctly chain promises, otherwise mocha can't pick up errors