<commit_before>import Chimee from 'index';

describe('dispatcher/binder', () => {
  let player;

  beforeEach(() => {
    player = new Chimee({
      // 播放地址
      src: 'http://cdn.toxicjohann.com/lostStar.mp4',
      // 直播:live 点播：vod
      type: 'vod',
      // 编解码容器
      box: 'native',
      // dom容器
      wrapper: 'body',
      plugin: [],
      events: {},
    });
  });

  afterEach(() => {
    player.destroy();
    player = null;
  });

  test('binder will clear kernel events which is forget to clear by upper layer', () => {
    player.__dispatcher.binder.on({
      target: 'kernel',
      name: 'heartbeat',
      id: 'illegal',
      fn: () => {},
    });
    expect(() => player.destroy()).not.toThrow();
  });
});<commit_msg>[update] cover all lines of binder<commit_after>import Chimee from 'index';

describe('dispatcher/binder', () => {
  let player;

  beforeEach(() => {
    player = new Chimee({
      // 播放地址
      src: 'http://cdn.toxicjohann.com/lostStar.mp4',
      // 直播:live 点播：vod
      type: 'vod',
      // 编解码容器
      box: 'native',
      // dom容器
      wrapper: 'body',
      plugin: [],
      events: {},
    });
  });

  afterEach(() => {
    player.destroy();
    player = null;
  });

  test('binder will clear kernel events which is forget to clear by upper layer', () => {
    player.__dispatcher.binder.on({
      target: 'kernel',
      name: 'heartbeat',
      id: 'illegal',
      fn: () => {},
    });
    expect(() => player.destroy()).not.toThrow();
  });

  test('binder triggersync isEventEmitalbe backup', () => {
    expect(() => player.__dispatcher.binder.triggerSync({})).not.toThrow();
  });

  test('binder emitsync isEventEmitalbe backup', () => {
    expect(() => player.__dispatcher.binder.emitSync({ name: 'hello' })).not.toThrow();
  });

  test('prettifyEventParameter without function', () => {
    expect(() => {
      player.__dispatcher.binder.on({
        name: 'what',
        target: 'plugin',
        stage: 'main',
      });
    }).toThrow('You must provide a function to handle with event what, but not undefined');
  });
});
{'fraction_non_alphanumeric': 0.1917024320457797, 'fraction_numerical': 0.0009537434430138292, 'mean_word_length': 2.456342668863262, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '4798113', 'n_tokens_mistral': 708, 'n_tokens_neox': 701, 'n_words': 150}