THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng | |
---|---|
Số trang | 180 |
Dung lượng | 1,89 MB |
Nội dung
Ngày đăng: 29/08/2020, 11:27
Nguồn tham khảo
Tài liệu tham khảo | Loại | Chi tiết |
---|---|---|
6. Create a test to demonstrate that our service is accessible and exposes a method:it('should store the response from the HTTP GET request', function() {}) | Khác | |
7. Create a reference to the promise instance by calling defer on the $q service:var defer = $q.defer() | Khác | |
8. Next, create a local variable populated using the emcee method on the mockData object:var emcee = jasmine.mockData.emcee() | Khác | |
9. Resolve our promise with the mock data from step 8:defer.resolve(emcee) | Khác | |
10. Using the spy that we created in step 3, chain the spy with and.returnValue to return the promise instance:httpMock.get.and.returnValue(defer.promise) | Khác | |
11. Next, call the getUKEmcee method on our service providing a value:emcees.getUKEmcee('1') | Khác | |
12. Use $scope.$digest to process all the watchers:$scope.$digest() | Khác | |
13. Finally, within the test created in step 6, add an expectation that the emcee object stored in our emcees service returns a value matching our mock data from step 8:expect(emcees.emcee.name).toBe(emcee.name) | Khác |
TÀI LIỆU CÙNG NGƯỜI DÙNG
TÀI LIỆU LIÊN QUAN