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