<commit_before>describe('Controller: DocumentController', function() {
  // new instance of the module
  beforeEach(angular.mock.module('frodocms'));

  var controller, Document, $location;

  // instantiate the main controller
  beforeEach(angular.mock.inject(function($injector, $controller) {
    Document = $injector.get('Document');
    $location = $injector.get('$location');
    Document.all = sinon.spy();
    controller = $controller('DocumentController');
  }));

  describe('Initialization', function() {
    it('Document.all should be a function and should be defined', function() {
      expect(Document.all.called).toBe(true);
      expect(typeof Document.all).toBe('function');
      Document.all.args[0][0]('data');
      expect(controller.documents).toBeDefined();
      expect(controller.documents).toBe('data');
    });
    it('createDocument is a function and should call Document.create', function() {
      Document.create = sinon.spy();
      controller.docData = {
        title: 'title',
        content: 'content'
      };
      controller.createDocument();
      expect(Document.create.called).toBe(true);
      expect(typeof Document.create).toBe('function');
      expect(controller.processing).toBe(true);
      expect(controller.docData).toBeDefined();
      expect(typeof controller.docData).toBe('object');
      $location.path = sinon.stub();
      Document.create.args[0][1]({
        success: true,
        message: 'message'
      });
      expect(controller.processing).toBe(false);
      expect(controller.message).not.toBe('');
      expect($location.path.called).toBe(true);
      Document.create.args[0][1]({
        success: false,
        message: 'message'
      });
      expect($location.path.calledOnce).toBe(true);
      expect(controller.error).toBeDefined();
      expect(controller.error).toBe('message');
    });
  });
});<commit_msg>[#110907918] Breaks long line causing linting error<commit_after>describe('Controller: DocumentController', function() {
  // new instance of the module
  beforeEach(angular.mock.module('frodocms'));

  var controller, Document, $location;

  // instantiate the main controller
  beforeEach(angular.mock.inject(function($injector, $controller) {
    Document = $injector.get('Document');
    $location = $injector.get('$location');
    Document.all = sinon.spy();
    controller = $controller('DocumentController');
  }));

  describe('Initialization', function() {
    it('Document.all should be a function and should be defined', function() {
      expect(Document.all.called).toBe(true);
      expect(typeof Document.all).toBe('function');
      Document.all.args[0][0]('data');
      expect(controller.documents).toBeDefined();
      expect(controller.documents).toBe('data');
    });
    it('createDocument is a function and should call Document.create',
      function() {
        Document.create = sinon.spy();
        controller.docData = {
          title: 'title',
          content: 'content'
        };
        controller.createDocument();
        expect(Document.create.called).toBe(true);
        expect(typeof Document.create).toBe('function');
        expect(controller.processing).toBe(true);
        expect(controller.docData).toBeDefined();
        expect(typeof controller.docData).toBe('object');
        $location.path = sinon.stub();
        Document.create.args[0][1]({
          success: true,
          message: 'message'
        });
        expect(controller.processing).toBe(false);
        expect(controller.message).not.toBe('');
        expect($location.path.called).toBe(true);
        Document.create.args[0][1]({
          success: false,
          message: 'message'
        });
        expect($location.path.calledOnce).toBe(true);
        expect(controller.error).toBeDefined();
        expect(controller.error).toBe('message');
      });
  });
});
{'fraction_non_alphanumeric': 0.1577995867768595, 'fraction_numerical': 0.005423553719008265, 'mean_word_length': 3.2795580110497236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '126291', 'n_tokens_mistral': 1065, 'n_tokens_neox': 1046, 'n_words': 180}