New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modernize install-blueprint-task.js test #8557
Modernize install-blueprint-task.js test #8557
Conversation
@Turbo87 Do we want to replace the the Like this:
with something like this
|
yes, I think something like this makes sense: it('resolves "foobar" by looking up the "foobar" blueprint locally', async function() {
let foobarBlueprint = { name: 'foobar blueprint' };
td.when(task._lookupBlueprint('foobar')).thenResolve(foobarBlueprint);
expect(await task._resolveBlueprint('foobar')).to.equal(foobarBlueprint);
}); |
9252fe1
to
dfb1a45
Compare
@Turbo87 Do you see any benefits in changing the way we handle testing promise rejections, from // normal function (and what we currently have in the codebase)
return expect(task.ensureBower()).to.be.rejectedWith('foobar'); to //async function
await expect(task.ensureBower()).to.be.rejectedWith('foobar'); The benefit I see in the second way, is that it would mean you always use async functions when you test Promises (rather than only use them when testing for resolved promises), but I'm not sure if it's worth switching for that alone. I've experimented with some other ways to test rejections, but everything I could think of was a lot more verbose or invasive than chai-as-promised |
@RichardOtvos yep, that second snippet looks 👌 to me! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 nice work, just a few small comments
This should be ready, let me know if you require any more changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
muchas gracias 👏
No description provided.