Created
January 27, 2022 04:49
-
-
Save RodolpheBeloncle/a83c0b414db5b1fc7ec3ffab24aaa985 to your computer and use it in GitHub Desktop.
JavaScript TDD 2 - Test Runners
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
| // capitalizeFirst.test.js | |
| const assert = require('assert'); | |
| const capitalizeFirstLetter = require('../capitalizeFirstLetter'); | |
| describe('capitalizeFirstLetter', () => { | |
| it('is a function that accepts one argument', () => { | |
| assert.strictEqual(typeof capitalizeFirstLetter, 'function'); | |
| assert.strictEqual(capitalizeFirstLetter.length, 1); | |
| }); | |
| it('transforms i am learning TDD correctly', () => { | |
| assert.strictEqual(capitalizeFirstLetter('i am learning TDD'), 'I am learning TDD'); | |
| }); | |
| it('works for a 1-character string', () => { | |
| assert.strictEqual(capitalizeFirstLetter('i'), 'I'); | |
| }); | |
| it('works for an empty string', () => { | |
| assert.strictEqual(capitalizeFirstLetter(''), ''); | |
| }); | |
| }); | |
| === test runner with moka === | |
| capitalizeFirstLetter | |
| ✓ is a function that accepts one argument | |
| ✓ transforms i am learning TDD correctly | |
| ✓ works for a 1-character string | |
| ✓ works for an empty string | |
| 4 passing (3ms) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment