Skip to content

Commit

Permalink
Merged second task branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mahammad-mostafa authored Jul 21, 2023
2 parents 9df3a8a + d65611c commit d9a876c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
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('');

0 comments on commit d9a876c

Please sign in to comment.