Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Can I get these issues resolved, perhaps?
Tests should be a little more logical now
Random tests added
Aha, I get you! Thank you for laying it out. I can't think of a way to test that an error is not thrown in place while simultaneously handling the unhandled rejection. The best I could come up with is
Should handle thrown errors as rejections
where it tests that an error thrown in the generator is turned into a rejection.Luckily, I can get a passing test for
Should not throw in place
and Codewars doesn't much care about unhandled rejections.I've also randomised much of the data in the test fixture.
As for async generators, I specifically wanted to emulate async/await with plain old generators. I should emphasise that in the description!
I could perhaps still do a better job of explaining in description; is there anything else I'm missing?
Thanks a lot for your assistance on my first kata.
EDIT: Oh I just thought of some nicer ways to randomise that would help prevent some of the brute forcing. Will update shortly.
Hello, yes
asynk
is supposed to return a Promise whether the last yielded/returned value from the generator is a Promise or not. The generator yields Promises to theasynk
function. You're right it's not an async generator, it's just a generator.The generator can
return
a Promise too, just like async functions can return a Promise. Or they can return values which are wrapped in Promises. Both of these async functions returns a Promise of 1:I want to highlight that the yields shouldn't be returned from
asynk
. Both of these should give you a Promise ofundefined
:I will, however, update the tests to be more logical, and since async functions allow you to
await
a non-Promise for some reason, perhaps I should allow that too?Please give me some pointers, as I'm new to writing tests.