scrimba
Unit Testing
Our first test (Challenge)
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Our first test (Challenge)
AboutCommentsNotes
Our first test (Challenge)
Expand for more info
main.js
run
preview
console
/* Unit Testing: It Test Challenge
*
* 1. Write a unit test for lastName and middleName to test its default values.
* 2. Group all 3 unit tests with an appropriate describe.
*/

// Test Suite
describe(`${User.name} Class`, () => {
it('first name defaults to empty', () => {
// arrange
const data = { firstName: null };

// act
const model = new User(data);

// assert
expect(model.firstName).toBe('');
});
});
Console
/index.html
-2:39