Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript Unit Testing!
You have completed JavaScript Unit Testing!
Preview
We might need some assertions other than equal. Let’s expand our test suite to be more descriptive and versatile.
Resources
Video review
- Chai's
.emptymethod checks for empty objects, arrays, or strings -
.emptymakes it easy to write expectations without worrying about how the real code will work - You call arrays that look the same “deeply equal”, because their “deep” internal values are equal
- The
.deepmethod allows you to make deep equality comparisons
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
So let's expand our test suite and see
some other things Chai and Mocha can do.
0:00
Now that we can check for a ship,
we also need to register damage on a ship.
0:02
Currently, check for
0:06
ship only reports true or false
depending where ships are located, but
0:07
we need to actually keep track of
the damage each ship has sustained, too.
0:12
So let's start a new test suite to
describe the damage ship function.
0:16
We introduce a test suite and
mocha using describe.
0:20
So right below the check for
ship suite we'll add describe.
0:24
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up