• Rather than having both upper and lower case in the expression include the 'i' flag which will make the expression case-insensitive meaning it will match regardless of case.

  • "increasing" and "decreasing" should be specified better. ATM, testing is so limited it allows for solving with a third category "constant" - this may or may not even be intentional.

  • The author's solution as it exists does weird things on them, so for now, no.

  • Should the plateaus be considered?

    If so, test cases should be reviewed

  • Needs random test cases, refer to this for examples :)

  • Needs random test cases

  • Similar to the "Overlapping Ranges" kata, please use the Test.assertEquals method. This at least makes it easy to see what the error was.

    Another suggestion is I highly recommend wrapping your tests in describe and it blocks (in both Katas). This enables more than one test to run before bailing.

    BTW: bkaes has put together an amazing document about writing good Katas. Definitely worth a read!

    Also, I believe the answer for this test is off-by-one. It states the index should be 3, but at the index 3 we're still increasing:

    idx:  0   1   2   3   4   5   6
    arr:  1   2   4   6   4   3   1
    dir:    +   +   +   -   -   -

    It is a matter of opinion as to where the result should be, but it really seems like the first number that changes the pattern is at index 4.

  • Other issues:

    • The test cases appear to be wrong. The second test case says the answer is false, when the overlap is 3, and the min overlap is 1. (The description states "…both ranges overlap by at least X numbers.")
    • The test cases only say "Correct" in the message.
      1. This is extremely confusing, since a failed case says "Correct".
      2. This is not useful. Even only testing on true/false you should use Test.assertEquals(actual, expected, msg), which will show what the expected result is. Since that still isn't very useful, it would be even better to change your message to actually say what should have happened ("The ranges 1…10 and 2…6 do not overlap by 12")
        You can wrap this in a helper function to make it easier, where you pass in the values and the expected outcome, and generate the test off of it.
    • Your description refers to the final number as X, you should just call it something like requiredOverlap, and match the parameter name in the code setup.
  • Your description of the problem doesn't match the expected solution or code setup (it says you'll receive an array, but 5 unique arguments are passed in).

    There's also no example test cases, which doesn't help.