Given the following promisified method:
const stat = Promise.promisify(fs.stat)
How to to stub the callback parameter of the stat method using sinon and test it with chai and chai-as-promised?
expect(stat('my_non_existing_file')).to.rejectedWith(Error)
expect(stat('my_existing_file')).to.eventually.deep.equal({
any_property: any_value
})
References:
Aucun commentaire:
Enregistrer un commentaire