Expects and promises implementation (untested)