8000 03_reverseString - update punctuation test case to include comma by vishpant76 · Pull Request #467 · TheOdinProject/javascript-exercises · GitHub
[go: up one dir, main page]

Skip to content

03_reverseString - update punctuation test case to include comma #467

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

Merged

Conversation

vishpant76
Copy link
Contributor

Because

In exercise 03_reverseString, there is currently no test case in the corresponding spec.js file that checks for commas in the input string. So a student could potentially write a solution that passes all existing test cases, however it may not be correct if it fails on a string having a comma. This has been described in further detail in issue #466. Hence it is necessary to have at least one test case that checks whether the student's solution is giving the correct output for an input string containing comma.

This PR

  • Modified the third test case in the reverseString.spec.js file such that the input string now contains a comma.
  test.skip('works with numbers and punctuation', () => {
    expect(reverseString('123! abc! Hello, Odinite.')).toEqual(
      '.etinidO ,olleH !cba !321'
    );
  });
  • Made the same change in the solution.spec.js as well.
  test('works with numbers and punctuation', () => {
    expect(reverseString('123! abc! Hello, Odinite.')).toEqual(
      '.etinidO ,olleH !cba !321'
    );
  });

Issue

Closes #466

Additional Information

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • The title of this PR follows the location of change: brief description of change format, e.g. 01_helloWorld: Update test cases
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If this PR includes any changes that affect the solution of an exercise, I've also updated the solution in the /solutions folder

Copy link
Contributor
@MaoShizhong MaoShizhong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks! 🚀

(for future readers: context is disallowing solutions where you convert an array to a string (e.g. .toString) then remove the generated commas, as opposed to using something like .join)

@MaoShizhong MaoShizhong merged commit d67e7a3 into TheOdinProject:main May 6, 2024
Oussama5379 added a commit to Oussama5379/javascript-exercises that referenced this pull request Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug - : 03_reverseString - No test case having commas in the input string
2 participants
0