Check out a free preview of the full Ember 2.x course:
The "Exercise 8" Lesson is part of the full, Ember 2.x course featured in this preview video. Here's what you'd learn in this lesson:

In this exercise, you will write a unit test for the computed property macro, an integration test for the {{github-org}} component, and an acceptance test for the application.

Get Unlimited Access Now

Transcript from the "Exercise 8" Lesson

[00:00:00]
>> [MUSIC]

[00:00:03]
>> Mike North: We're going to start with unit integration tests. I want to, and I have a mistake here, actually. So I want us to write the unit test for this computer property macro that we built. Right. Unit test for the computer property macro. For the integration test, I want integration tests for the github-org component and make sure that you touch on, that the data that you are passing through the contract with the outside world.

[00:00:35] You know the org, that it's name will actually show up in the DOM and also that the favorite button will fire the appropriate action when clicked.
>> Mike North: And then I have instructions for an acceptance test. It seems like a lot of steps. But, it's not too bad and to save you guys some time I have actually mocked out the pretender, like I've given you some sample data to use with pretender so that you can not have to worry about figuring out what the valid payload should be.

[00:01:15] So, I would just go to the pdf, copy this, what's that?
>> Speaker 2: You can't copy text out of the pdf?
>> Mike North: So I will make this available as a gist and post the link in chat right away. The way you add pretender to your app is ember install ember-cli-pretender.

[00:01:36] That's it. And the way you get access to the pretender object itself. Is just by importing it from Pretender just like you import Ember from Ember. So, hopefully, this will let you guys focus on the particulars of the test and not on the mocking of the data here.

[00:01:54] All right. Do we have any questions before we dive in and get started? And I think we should allow maybe 30 minutes for this, because there are three types of tests I'm asking for, and I want to make sure you guys have a good understanding of this.
>> Speaker 3: Is the unit tester even lane module?

[00:02:13]
>> Mike North: I want, yeah, I need to fix that. What I want the unit test on is the computer property macro, that we just built in the last exercise. Is an array or whatever that is, yes question.
>> Speaker 4: This is back on the computed properties but he was just asking if could we avoid using computed properties with data down actions up pattern?

[00:02:36]
>> Mike North: Computed properties play very nicely with actions up, bindings down. So, that's all advisable to work together, what you don't want are observers.