<commit_before>/**
 * core.spec.ts
 *
 * There are a number of message types and interactions which prepare the
 * roster, clients, and instances. These have various caveats and edge cases,
 * and can also be received in different orders. This file lays out these
 * requirement and ensures consistency.
 */
/// <reference path='../../../third_party/typings/jasmine/jasmine.d.ts' />

import globals = require('./globals');
import social = require('../interfaces/social');
import social_network = require('./social');
import remote_user = require('./remote-user');
import local_instance = require('./local-instance');
import remote_instance = require('./remote-instance');
import uproxy_core_api = require('../interfaces/uproxy_core_api');
import uproxy_core = require('./uproxy_core');

describe('Core', () => {

  // Set up a fake network -> roster -> user -> instance chain.
  var network = <social.Network><any>jasmine.createSpy('network');
  network.getUser = null;
  network.getStorePath = function() { return 'network-store-path'; };
  network['login'] = (reconnect :boolean) => { return Promise.resolve<void>() };
  network['myInstance'] =
            new local_instance.LocalInstance(network, 'localUserId');
  var user = new remote_user.User(network, 'fake-login');
  user.getInstance = null;
  user.notifyUI = () => {};
  user.getLocalInstanceId = () => { return 'fake/userpath'; };
  var alice = new remote_instance.RemoteInstance(user, 'instance-alice');
  var core = new uproxy_core.uProxyCore();

  beforeEach(() => {
    spyOn(console, 'log');
  });
<commit_msg>Mock out the probeProtocolSupport function.<commit_after>/**
 * core.spec.ts
 *
 * There are a number of message types and interactions which prepare the
 * roster, clients, and instances. These have various caveats and edge cases,
 * and can also be received in different orders. This file lays out these
 * requirement and ensures consistency.
 */
/// <reference path='../../../third_party/typings/jasmine/jasmine.d.ts' />

import globals = require('./globals');
import social = require('../interfaces/social');
import social_network = require('./social');
import remote_user = require('./remote-user');
import local_instance = require('./local-instance');
import remote_instance = require('./remote-instance');
import uproxy_core_api = require('../interfaces/uproxy_core_api');
import uproxy_core = require('./uproxy_core');

describe('Core', () => {

  // Set up a fake network -> roster -> user -> instance chain.
  var network = <social.Network><any>jasmine.createSpy('network');
  network.getUser = null;
  network.getStorePath = function() { return 'network-store-path'; };
  network['login'] = (reconnect :boolean) => { return Promise.resolve<void>() };
  network['myInstance'] =
            new local_instance.LocalInstance(network, 'localUserId');
  var user = new remote_user.User(network, 'fake-login');
  user.getInstance = null;
  user.notifyUI = () => {};
  user.getLocalInstanceId = () => { return 'fake/userpath'; };
  var alice = new remote_instance.RemoteInstance(user, 'instance-alice');
  // Mock out the probeProtocolSupport function.
  globals.portControl.probeProtocolSupport = () => {
    return Promise.resolve({"natPmp": false, "pcp": false, "upnp": false});
  };
  var core = new uproxy_core.uProxyCore();

  beforeEach(() => {
    spyOn(console, 'log');
  });

{'fraction_non_alphanumeric': 0.1600831600831601, 'fraction_numerical': 0.0, 'mean_word_length': 4.337559429477021, 'pattern_counts': {'":': 3, '<': 11, '<?xml version=': 0, '>': 28, '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': '7541042', 'n_tokens_mistral': 976, 'n_tokens_neox': 961, 'n_words': 255}