Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define(['angularMocks', 'services', 'controllers', 'app'],
- function (angularMocks, services) {
- describe('SelectDesignCtrl', function () {
- var scope,
- msgService; //we'll use this scope in our tests
- //mock Application to allow us to inject our own dependencies
- beforeEach(module('editor.services'));
- beforeEach(module('editor.controllers'));
- beforeEach(module('editor'));
- //mock the controller for the same reason and include $rootScope and $controller
- beforeEach(angular.mock.inject(
- function ($rootScope, $controller, $location, messageService) {
- msgService = messageService;
- spyOn(msgService, 'getDesigns');
- //create an empty scope
- scope = $rootScope.$new();
- //declare the controller and inject our empty scope
- $controller('SelectDesignCtrl', { $scope: scope }, $location, msgService);
- spyOn(scope, 'selectDesign');
- }
- )
- );
- // tests start here
- it('should stress generate new mails', function () {
- var saveOptions = {
- generatePreview: false,
- forceSave: true
- };
- // for (var i = 0; i < 1000; i++) {
- // generar un mail
- console.log('start creation');
- msgService.save(saveOptions, function () {
- msgService.setHeader({
- id: 0
- });
- console.log('new mail end');
- });
- // }
- });
- it('should have get designs', function () {
- expect(scope.selectDesign).not.toHaveBeenCalled();
- expect(msgService.getDesigns).toHaveBeenCalled();
- expect(msgService.getDesigns.mostRecentCall.args[0])
- .toEqual({ pageIndex: 0, pageSize: 30, searchText: '', orderBy: 'Date Added' });
- });
- });
- }
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement