2018-08-07 10:23:28 +00:00
|
|
|
const reverseString = require('./reverseString')
|
2017-08-17 21:19:17 +00:00
|
|
|
|
2021-03-03 02:13:24 +00:00
|
|
|
describe('reverseString', () => {
|
|
|
|
test('reverses single word', () => {
|
2017-08-17 21:19:17 +00:00
|
|
|
expect(reverseString('hello')).toEqual('olleh');
|
|
|
|
});
|
|
|
|
|
2021-08-07 06:52:11 +00:00
|
|
|
test('reverses multiple words', () => {
|
2017-08-17 21:19:17 +00:00
|
|
|
expect(reverseString('hello there')).toEqual('ereht olleh')
|
|
|
|
})
|
|
|
|
|
2021-08-07 06:52:11 +00:00
|
|
|
test('works with numbers and punctuation', () => {
|
2017-08-17 21:19:17 +00:00
|
|
|
expect(reverseString('123! abc!')).toEqual('!cba !321')
|
|
|
|
})
|
2021-08-07 06:52:11 +00:00
|
|
|
test('works with blank strings', () => {
|
2020-05-08 06:56:55 +00:00
|
|
|
expect(reverseString('')).toEqual('')
|
|
|
|
})
|
2018-08-07 10:23:28 +00:00
|
|
|
});
|