Ad
  • Custom User Avatar

    Lots of specs aren't even mentioned in the description or sample tests, e.g:

    • Calling fulfill before when should trigger the callback as well
    • Calling fulfill with no arguments
  • Custom User Avatar

    The Join waits untill all Future are fulffiled and aggregate their errors and responses as an array.

    This requirement is nonsensical: a Future is not supposed to leak its registered callback functions out (just think of Promise); however there are no ways to chain downstream into an existing Future like Promise.prototype.then, hence it's not possible to know when an existing Future is fulfilled besides the instance itself, and Join cannot be implemented.

    Edit: okay it just got even more nonsensical: Join is expected to take in a bunch of Futures without when called and then be supplied with a when function and set each Future's callback with it? Then the two of them are highly coupled.

  • Custom User Avatar

    Test feedback is really bad. Every assertion is using Test.expect with no message strings telling where the assertion come from.

  • Default User Avatar

    The join.when() function should return errors and values in the same order the callbacks had been added even if the futures were resolved in different order than they were added.

    The current test cases are not testing for it so a wrong solution passes.

  • Custom User Avatar

    I liked very much. Greate Kata.

  • Custom User Avatar

    Done. Thank you!

  • Custom User Avatar

    This fix my problem. Thanks!

  • Custom User Avatar

    In hte description, you must change:

    join.add(doSomethingASync);
    

    With this:

    join.add(doSomethingASync());
    
  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    You are right. I will fix it and add tests to cover that case. Thank you very much.

  • Custom User Avatar

    This won't really work if you fulfill the Future with falsy values, will it?

    var f = new Future();
    f.fulfill(null, 0);
    f.when(consol.log); // Will never be called.