6 kyu

EventEmitter

Description
Loading description...
Data Structures
Arrays
Algorithms
Fundamentals
  • Please sign in or sign up to leave a comment.
  • Twilight_Sun Avatar
    1. There's no random tests
    2. tests don't check that blocks was called at all, so just returning blocks works as well
  • jforster Avatar

    This comment has been hidden.

  • jimmylorunning Avatar

    It's a good kata. I had to read the description several times before I got it.

    Maybe "you must be able to subscribe n number of blocks to the same key" could be "you must be able to subscribe multiple blocks to the same key"

  • JoshBrodieNZ Avatar

    This comment has been hidden.

  • JoshBrodieNZ Avatar

    I seem to have the only solution which returns the Procs but doesn't explicitly call() them?

    Which was the intended behaviour, returning an array of Procs or an array of the results?

  • Abbe Avatar

    I like the kata. I seem to remember seeing a similar one for JavaScript before. However, it isn't clear what the trigger method is supposed to do and return.

    The description says that the blocks for the event should be called and if there are not blocks for an event, nil or an empty array should be returned. It says nothing on what to return when there are blocks. (It could be nothing, the return values of the blocks as an array, or the blocks themselves).

    Looking at the test cases, the last test case checks that the actual blocks are returned and not the results. Actually, just returning the blocks without executing them passes the tests as well.

    • Lordnibbler Avatar

      I have updated the kata per your comments above. Can you take another look? I think its much clearer now, and have added back in the additional tests to make the solution more strict.

    • Abbe Avatar

      I think it's much clearer now.

      However, your second test case doesn't seem to check for a block, but for the value of the called block.

    • Lordnibbler Avatar

      How do you suggest I update it? That test was just to ensure that a block was saved in the EventEmitter and could be called.