<commit_before>describe('VK widget', function () {

  beforeEach(module('vk-api-angular'));

  beforeEach(inject(function (_$compile_, _$rootScope_) {
    $compile = _$compile_;
    $rootScope = _$rootScope_;
  }));

  describe('"Allow Messages from Community"', function () {
    it('calls VK.Widgets.AllowMessagesFromCommunity() Open API method', function () {
      var spy = spyOn(VK.Widgets, 'AllowMessagesFromCommunity');
      $compile('<vk-allow-messages-from-community></vk-allow-messages-from-community>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalled();
    });
  });

  describe('"Auth"', function () {

    it('calls VK.Widgets.Auth() Open API method', function () {
      var spy = spyOn(VK.Widgets, 'Auth');
      $compile('<vk-auth></vk-auth>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalled();
    });

    it('calls onAuth() callback', function () {
      $rootScope.callback = function () {};
      var spy = spyOn($rootScope, 'callback');
      $compile('<vk-auth on-auth="callback"></vk-auth>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalledWith(jasmine.any(Object));
    });

    it('redirects if no callback is passed', function () {
      $rootScope.callback = function () {};
      var spy = spyOn(VK.Test, 'redirect');
      var redirectUrl = 'http://google.com';
      $compile('<vk-auth auth-url="' + redirectUrl + '"></vk-auth>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalledWith(redirectUrl);
    });
  });

  describe('"Comments"', function () {
    it('calls VK.Widgets.Comments() Open API method', function () {
      var spy = spyOn(VK.Widgets, 'Comments');
      $compile('<vk-comments></vk-comments>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalled();
    });
  });

  describe('"Community"', function () {
    it('calls VK.Widgets.Community() Open API method', function () {
      var spy = spyOn(VK.Widgets, 'Community');
      $compile('<vk-community></vk-community>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalled();
    });
  });

  describe('"Community Messages"', function () {

    it('calls VK.Widgets.CommunityMessages() Open API method', function () {
      var spy = spyOn(VK.Widgets, 'CommunityMessages');
      $compile('<vk-community-messages></vk-community-messages>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalled();
    });

    it('calls onCanNotWrite() callback', function () {
      $rootScope.callback = function () {};
      var spy = spyOn($rootScope, 'callback');
      $compile('<vk-community-messages on-can-not-write="callback"></vk-community-messages>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalledWith(jasmine.any(String));<commit_msg>Fix mock object settings zeroing<commit_after>describe('VK widget', function () {

  beforeEach(module('vk-api-angular'));

  beforeEach(inject(function (_$compile_, _$rootScope_) {
    $compile = _$compile_;
    $rootScope = _$rootScope_;
    VK.Test.error = false;
  }));

  describe('"Allow Messages from Community"', function () {
    it('calls VK.Widgets.AllowMessagesFromCommunity() Open API method', function () {
      var spy = spyOn(VK.Widgets, 'AllowMessagesFromCommunity');
      $compile('<vk-allow-messages-from-community></vk-allow-messages-from-community>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalled();
    });
  });

  describe('"Auth"', function () {

    it('calls VK.Widgets.Auth() Open API method', function () {
      var spy = spyOn(VK.Widgets, 'Auth');
      $compile('<vk-auth></vk-auth>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalled();
    });

    it('calls onAuth() callback', function () {
      $rootScope.callback = function () {};
      var spy = spyOn($rootScope, 'callback');
      $compile('<vk-auth on-auth="callback"></vk-auth>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalledWith(jasmine.any(Object));
    });

    it('redirects if no callback is passed', function () {
      $rootScope.callback = function () {};
      var spy = spyOn(VK.Test, 'redirect');
      var redirectUrl = 'http://google.com';
      $compile('<vk-auth auth-url="' + redirectUrl + '"></vk-auth>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalledWith(redirectUrl);
    });
  });

  describe('"Comments"', function () {
    it('calls VK.Widgets.Comments() Open API method', function () {
      var spy = spyOn(VK.Widgets, 'Comments');
      $compile('<vk-comments></vk-comments>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalled();
    });
  });

  describe('"Community"', function () {
    it('calls VK.Widgets.Community() Open API method', function () {
      var spy = spyOn(VK.Widgets, 'Community');
      $compile('<vk-community></vk-community>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalled();
    });
  });

  describe('"Community Messages"', function () {

    it('calls VK.Widgets.CommunityMessages() Open API method', function () {
      var spy = spyOn(VK.Widgets, 'CommunityMessages');
      $compile('<vk-community-messages></vk-community-messages>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalled();
    });

    it('calls onCanNotWrite() callback', function () {
      VK.Test.error = true;
      $rootScope.callback = function () {};
      var spy = spyOn($rootScope, 'callback');
      $compile('<vk-community-messages on-can-not-write="callback"></vk-community-messages>')($rootScope);
      $rootScope.$digest();
      expect(spy).toHaveBeenCalledWith(jasmine.any(String));
{'fraction_non_alphanumeric': 0.19297635605006955, 'fraction_numerical': 0.0, 'mean_word_length': 3.6734362307067423, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, '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': '3364046', 'n_tokens_mistral': 1864, 'n_tokens_neox': 1775, 'n_words': 287}