Created
March 4, 2022 19:49
-
-
Save djalmajr/3f17f587e0b9ea9a59be3f79a22697ed to your computer and use it in GitHub Desktop.
Capitalize Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* capitalize.js | |
* | |
* @param {string} str | |
* @returns string | |
*/ | |
function capitalize(str) { | |
} | |
module.exports = { capitalize }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* capitalize.test.js | |
* | |
* npx jest --runTestsByPath capitalize.test.js | |
*/ | |
const { capitalize } = require('./capitalize.js'); | |
describe('Capitalize', function () { | |
it('Single Word', function () { | |
expect(capitalize("hello")).toEqual("Hello"); | |
}); | |
it('Multiple Words', function () { | |
expect(capitalize("hello world")).toEqual("Hello World"); | |
}); | |
it('Outter Spaces', function () { | |
expect(capitalize(" hello world ")).toEqual("Hello World"); | |
}); | |
it('Inner Spaces', function () { | |
expect(capitalize("hello world")).toEqual("Hello World"); | |
}); | |
it('Multiple UpperCase', function () { | |
expect(capitalize("heLLo woRLd")).toEqual("Hello World"); | |
}); | |
it('All In', function () { | |
expect(capitalize(" heLLo woRLd ")).toEqual("Hello World"); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "verbose": true } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment