mirror of
				https://github.com/mmumshad/ansible-playable.git
				synced 2025-03-09 23:38:54 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			37 lines
		
	
	
	
		
			961 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
	
		
			961 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 'use strict';
 | |
| 
 | |
| import main from './main.component';
 | |
| import {
 | |
|   MainController
 | |
| } from './main.component';
 | |
| 
 | |
| describe('Component: MainComponent', function() {
 | |
|   beforeEach(angular.mock.module(main));
 | |
|   beforeEach(angular.mock.module('stateMock'));
 | |
| 
 | |
|   var scope;
 | |
|   var mainComponent;
 | |
|   var state;
 | |
|   var $httpBackend;
 | |
| 
 | |
|   // Initialize the controller and a mock scope
 | |
|   beforeEach(inject(function(_$httpBackend_, $http, $componentController, $rootScope, $state) {
 | |
|     $httpBackend = _$httpBackend_;
 | |
|     $httpBackend.expectGET('/api/things')
 | |
|       .respond(['HTML5 Boilerplate', 'AngularJS', 'Karma', 'Express']);
 | |
| 
 | |
|     scope = $rootScope.$new();
 | |
|     state = $state;
 | |
|     mainComponent = $componentController('main', {
 | |
|       $http,
 | |
|       $scope: scope
 | |
|     });
 | |
|   }));
 | |
| 
 | |
|   it('should attach a list of things to the controller', function() {
 | |
|     mainComponent.$onInit();
 | |
|     $httpBackend.flush();
 | |
|     expect(mainComponent.awesomeThings.length)
 | |
|       .to.equal(4);
 | |
|   });
 | |
| });
 |