Ad
  • Custom User Avatar

    https://www.codewars.com/kata/5a95947f4a6b342636000173/train/javascript

    When I try to submit it it gives error expected "Bunny" and my result shows " Bunny "

  • Custom User Avatar

    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

      let promise = fetch(`...`);
      promise.then(...)
      return promise
    

    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

  • Custom User Avatar

    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.

    it('should throw an error', async (done) => {
      
      Test.expectError('if no joke found for given id', async () => {
        await sayJoke(url, 12101)
      })
      
      done();
    });
    

    This code doesn't work. I think, it get a promise and don't test the method.

    How I can implement it ?

  • Custom User Avatar

    The kata's spec is very confusing: beaming people are supposed to be held in the inTransit properties. But then beaming 3 people should have them all beamed at once? Then what's the purpose of inTransit properties? They are supposed as a temporary storage, which means they shouldn't be tested (not to mention in reality it's not something that's actually needed).

  • Custom User Avatar

    As mentioned below, poor kata design.

  • Custom User Avatar

    Hi, @richkotze!

    Thanks for a nice kata.

    But, what if typeof childten isn't a string?

      it('should not shorten text unless typeof children is string', () => {
        const result = shallow(<ShortParagraph><b>{text}</b></ShortParagraph>);
        expect(result.children().text()).toEqual(text);
      });