Add solution directories for exercises

This commit is contained in:
thatblindgeye
2022-02-20 14:07:44 -05:00
parent 1971712fde
commit fb1a2db8d7
26 changed files with 600 additions and 0 deletions
@@ -0,0 +1,5 @@
const reverseString = function (string) {
return string.split('').reverse().join('');
};
module.exports = reverseString;
@@ -0,0 +1,18 @@
const reverseString = require('./reverseString-solution');
describe('reverseString', () => {
test('reverses single word', () => {
expect(reverseString('hello')).toEqual('olleh');
});
test.skip('reverses multiple words', () => {
expect(reverseString('hello there')).toEqual('ereht olleh');
});
test.skip('works with numbers and punctuation', () => {
expect(reverseString('123! abc!')).toEqual('!cba !321');
});
test.skip('works with blank strings', () => {
expect(reverseString('')).toEqual('');
});
});