Kent walks through the solution to the Writing Unit Tests exercise. The code for the solution is located on the FEM/05.1-write-tests branch.
(flute)…- I'm going to go ahead and work through this solution now.…Going to leave that open.…So for the Star Wars names dot all api…like I said all that I really care about…is that every item in this is a string.…So I'm actually going to create a utility function down here…called is array of strings.…
We're alt passing array.…And I'm going to use return array dot every.…This is just a method that's available on all arrays.…And it will take a function, it takes an item…and it returns the item, sorry,…the type of item is equal to a string.…So then I can use that function in my test up here…where I say expect is array of strings, oh yeah,…and I totally forgot…you need to require the Star Wars names alt.…
So bar Star Wars names…is require,…actually it's index dot js.…Actually, fun fact, in note version four I think…you can actually just say require dot…and it will give you the index…inside your current directory.…So fun fact.…So we're going to use Star Wars names dot all.…And we'll just say to be true.…
Expect is array of strings,…
Note: This course was created by Frontend Masters. It was originally released on 08/09/2016. We're pleased to host this training in our library.
- Creating an open-source library
- Linting and testing
- Code coverage
- Installing and configuring Babel
- Peer dependencies
- Forking and renaming
- Continuous integration and automating releases
Skill Level Intermediate
1. Creating an Open-Source Library
2. Linting and Testing
3. Git Hooks, Babel, and Webpack
4. Continuous Integration and Automating Releases
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.