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

Test & Solution for #8 (MERGE CONFLICTS RESOLVED) #104

Merged
merged 3 commits into from
Jun 15, 2017
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
13 changes: 13 additions & 0 deletions solutions/8.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ const solution = (string) => {
return newString;
};

// Maricris Bonzo: seemcat

const solution1 = (string) => {
let indexLength = string.length - 1;
let reverseString = '';

for(i = 0; i <= indexLength; i++){
reverseString = string[i] + reverseString;
}
return reverseString;
};

module.exports = {
solution,
solution1
};
24 changes: 23 additions & 1 deletion test/8.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const expect = require('chai').expect;
let solution = require('../solutions/8').solution;
solution = require('../yourSolution').solution;
let solution1 = require('../solutions/8').solution1;
// solution = require('./yourSolution').solution;

describe('reverse String', () => {
it('should reverse a string in reverse', () => {
Expand All @@ -23,4 +24,25 @@ describe('reverse String', () => {
const expected = "welcome emoclew";
expect(solution(actual)).to.equal(expected);
});
it('should reverse a string in reverse', () => {
const actual = "react";
const expected = "tcaer";
expect(solution1(actual)).to.equal(expected);
});
it('should reverse a string in reverse', () => {
const actual = "word";
const expected = "drow";
expect(solution1(actual)).to.equal(expected);
});
it('should reverse a string in reverse', () => {
const actual = "I";
const expected = "I";
expect(solution1(actual)).to.equal(expected);
});
it('should reverse a string in reverse', () => {
const actual = "welcome emoclew";
const expected = "welcome emoclew";
expect(solution1(actual)).to.equal(expected);
});

});