Ad
  • Custom User Avatar

    A lot of people seem to be caught up on the fact that the mocked fetch function doesn't return any HTTP status information with the response. Maybe it would be appropriate to either have the mock fetch function return HTTP status information in its response or add a note to the description that warns users not to bother checking for it.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • 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);
      });