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.
TypeScript translation based on existing JavaScript version.
great one
https://www.codewars.com/kata/5a95947f4a6b342636000173/train/javascript
When I try to submit it it gives error expected "Bunny" and my result shows " Bunny "
in the preloaded section, there is a function called
fetch()
written by the kata author. call it with an url. it mimicks the behavior of the real fetch APInot a proper issue report
could anyone help?)
I've stucked with the problem
function (it) run longer that 500ms
Oh god. It was really painfully. I sat with this problem for several hours(about 4-5).
As a result, the error was that fetch(url) should ALWAYS come immediately followed by ".then()".
You can't write
But I dont know why. May be it is related with a microtasks stack? If there is anyone who knows, please tell me the topics that I could read
new FetchError(
request to ${request.url} failed, reason: ${err.message}
, 'system', err)Ok. Nice exercice for Christmas. I try to write a test for errors. It should throw an error if the given joke id does not exist.
This code doesn't work. I think, it get a promise and don't test the method.
How I can implement it ?
You have to add a 'saySetup' and 'sayPunchLine' methods to the object of your result. So that e.g. result.saySetup() returns the corrent answer.
Tests are running against a valid api endpoint (that is hidden from us).
What you have to do :
A useful link :
https://reactjs.org/docs/higher-order-components.html#use-hocs-for-cross-cutting-concerns
I don't understand what exactly I'm supposed to be returning. I am able to get the result and isolate the correct joke but I don't know what to return nor do I understand the error message I am getting.
The instructions say:
"When you got the joke it should be accessible through a simple API of saySetup and sayPunchLine methods."
Can an example of what a correct return message would look like be posted? I am able to get the return object and find the correct joke but what exactly am I supposed to return?
I have similar questions regarding the error case as well but can't address those till I can solve the above.
What does it mean 'use mock
fetch(url)
'? Should I mock it myself or use realfetch()
?API URL http://great.jokes/christmas is not reachable.
Loading more items...