From the course: JavaScript: Test-Driven Development (ES6)

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Solution: Given criteria, write unit tests

Solution: Given criteria, write unit tests - JavaScript Tutorial

From the course: JavaScript: Test-Driven Development (ES6)

Start my 1-month free trial

Solution: Given criteria, write unit tests

(upbeat music) - [Instructor] Okay, so now let's see what one possible way of solving this challenge might be. And this is just the way that I would do it. If you have something a little different don't worry about it too much. So we've got our files created, and the first thing that I'm going to do is import some of the things that we'll need at the top of our test file. So I'm going to import expect from chai to make our assertions, and then I'm going to import our isAnagram function, import isAnagram from Anagrams. And this of course doesn't exist yet. So now to group our files we're going to have a describe block here. And inside we're going to say, isAnagram basic functionality. And I'm going to put these comments that I typed out in the last video just to give us a guideline of the things that we need to test. So the first test that we're going to write we're going to say it returns true when two known anagrams…

Contents