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

Second task #2

Merged
merged 3 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ It also includes config linters for `JavaScript` in the `.github` directory.
- Unit testing done with `Jest` framework

📌 **Key Features:**
- Function `stringLength.js` return a number for the input string length
- Any string length outside the range of (1 - 10) throws an error `Value out of range!`
- 3 Test cases are implemented in `stringLength.test.js` for checking valid & invalid input
- Each task has its own unit & tester file
- All tasks have separate test suite with description text
- Function `stringLength` returns a number for the input string length
- Any string length outside the range of `(1 - 10)` throws an error `Value out of range!`
- Three test cases are implemented in `stringLength.test.js` for checking valid & invalid input
- Function `reverseString` return the input string with characters in reverse order
- One test case was done for `reverseString` function in `reverseString.test.js`

<p align="right"><a href="#title">back to top</a></p>

Expand Down
7 changes: 7 additions & 0 deletions testers/reverseString.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const reverseString = require('../units/reverseString.js');

describe('Testing reverseString function', () => {
test('The string "bat" should be reversed to "tab"', () => {
expect(reverseString('bat')).toMatch('tab');
});
});
1 change: 1 addition & 0 deletions units/reverseString.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = (string) => string.split('').reverse().join('');