2024-01-05 19:11:55 +00:00
|
|
|
const reverseString = require('./reverseString')
|
|
|
|
|
|
|
|
describe('reverseString', () => {
|
|
|
|
test('reverses single word', () => {
|
|
|
|
expect(reverseString('hello')).toEqual('olleh');
|
|
|
|
});
|
|
|
|
|
2024-01-05 19:51:18 +00:00
|
|
|
test('reverses multiple words', () => {
|
2024-01-05 19:11:55 +00:00
|
|
|
expect(reverseString('hello there')).toEqual('ereht olleh')
|
|
|
|
})
|
|
|
|
|
2024-01-05 19:51:18 +00:00
|
|
|
test('works with numbers and punctuation', () => {
|
2024-01-05 19:11:55 +00:00
|
|
|
expect(reverseString('123! abc!')).toEqual('!cba !321')
|
|
|
|
})
|
2024-01-05 19:51:18 +00:00
|
|
|
test('works with blank strings', () => {
|
2024-01-05 19:11:55 +00:00
|
|
|
expect(reverseString('')).toEqual('')
|
|
|
|
})
|
|
|
|
});
|