scrimba
Unit Testing
Setting Up Our Data with beforeEach (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

Setting Up Our Data with beforeEach (Challenge)
AboutCommentsNotes
Setting Up Our Data with beforeEach (Challenge)
Expand for more info
main.js
run
preview
console
/* Unit Testing: Setting Up Data with beforeEach Challenge
*
* 1. Add a new describe for the fullName
* 2. Fully test the fullName get
* 3. Use a nested beforeEach
*/

// Test Suite
describe(`${User.name} Class`, () => {
let model;

beforeEach(() => {
model = new User();
});

describe('default values', () => {
it('first name defaults to empty', () => {
// assert
expect(model.firstName).toBe('');
});

it('last name defaults to empty', () => {
// assert
expect(model.lastName).toBe('');
});

it('middle name defaults to empty', () => {
// assert
expect(model.middleName).toBe('');
});
});
});
Console
/index.html
-6:43