JSFiddle - React, Tailwind, and code Playground

by sandro_paganotti

JavaScript

'use strict';

describe('Controller: MainCtrl', function () {

  var $httpBackend;

  // load the controller's module
  beforeEach(module('waitressApp'));

  var MainCtrl,
    scope;

  beforeEach(inject(function($injector){
    $httpBackend = $injector.get('$httpBackend');
    $httpBackend.when('GET','/pippo').respond({msg: 'hello'});
  }));

  // Initialize the controller and a mock scope
  beforeEach(inject(function ($controller, $rootScope) {
    scope = $rootScope.$new();
    MainCtrl = $controller('MainCtrl', {
      $scope: scope
    });
  }));

  it('should attach a list of awesomeThings to the scope', function () {
    expect(scope.awesomeThings.length).toBe(3);
    $httpBackend.flush();
    expect(scope.msg).toBe('hello');
  });
});