Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In 05_sumAll: Improve testing to match exercise description #510

Open
4 of 5 tasks
RedViperPT opened this issue Dec 17, 2024 · 1 comment
Open
4 of 5 tasks

In 05_sumAll: Improve testing to match exercise description #510

RedViperPT opened this issue Dec 17, 2024 · 1 comment
Labels
Status: Needs Review This issue/PR needs an initial or additional review

Comments

@RedViperPT
Copy link

Prerequisites

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • I have searched the existing issues to ensure this improvement hasn't been suggested before (please have a look through our open issues list to make sure)
  • The title of this issue follows the <Location of the improvement>: <Brief description of the improvement> format, e.g. Exercises: Add exercise on XYZ
  • (Optional) I am interested in working on this issue and would like to be assigned to it

Improvement Description

While working through the exercise, I noticed that the tests don't check if you're actually adding the numbers between two arbitrary positive integers. It's possible to write a program that just adds all the numbers up to the biggest value given and still pass the tests.

  test('sums numbers within the range', () => {
    expect(sumAll(1, 4)).toEqual(10);
  });
  test('works with large numbers', () => {
    expect(sumAll(1, 4000)).toEqual(8002000);
  });
  test('works with larger number first', () => {
    expect(sumAll(123, 1)).toEqual(7626);
  });

Since all the tests start at 1 you can skip part of the exercise by just finding the biggest value.

This should be easy to fix by either modifying one of the tests or adding a new one.

Acceptance Criteria

  • Test verify user is adding between the two given numbers.

(Optional) Additional Comments

No response

@RedViperPT RedViperPT added the Status: Needs Review This issue/PR needs an initial or additional review label Dec 17, 2024
@CouchofTomato
Copy link
Member

@TheOdinProject/javascript Can someone review please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Review This issue/PR needs an initial or additional review
Projects
None yet
Development

No branches or pull requests

2 participants