TheOdinProject/javascript-exercises

05_sumAll: Make clear that negative numbers and non-errors should return ERROR

Closed this issue · 2 comments

Complete the following REQUIRED checkboxes:

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • The title of this issue follows the location for request: brief description of request format, e.g. Exercises: Add exercise on XYZ

The following checkbox is OPTIONAL:

  • I would like to be assigned this issue to work on it, but I could also see it as a good first issue, in which case I'd rather yield it to a new contributor

1. Description:
sumAll's tests expect that calling the function with non-integers or negative integers returns the string 'ERROR', but this requirement is stated nowhere, and based on the exercises before it it is not reasonable for a learner to assume that their function will be called with "wrong" arguments or that if so they should return 'ERROR'.

2. Acceptance Criteria:

Hi @Asartea !

For a lot of these exercises the learners are expected to read the tests to find out the requirements.

Example from 02_repeatstring:

test.skip('returns ERROR with negative numbers', () => {
    expect(repeatString('hey', -1)).toEqual('ERROR');
  });

And here's a quote from the readme in the first `hello world exercise which explains a bit about the tests:

For now you do not need to worry about how to write tests, but you should try to get comfortable enough with the syntax to figure out what the tests are asking you to do.

From the above I do believe the intention seems to be that the requirements to pass the tests should be taken from the tests themselves. I also get that feeling from looking at the other exercises which will have failed tests if you don't look at the test requirements themselves.

Please let me know if you think I'm missing something.

Nope you are completely right; I vaguely remember something like that but couldn't find it when I skimmed the repo before filing the issue.