<commit_before>const expect = require('chai').expect;

const Player = require('../../src/player.js').Player;
const Npc    = require('../../src/npcs.js').Npc;

const CombatUtil   = require('../../src/combat_util.js').CombatUtil;
const CombatHelper = require('../../src/combat_util.js').CombatHelper;

describe('Player/NPC Combat Helper', () => {
  const testPlayer = new Player();

  it('should create a new instance', () => {
    expect(testPlayer.combat instanceof CombatHelper).to.be.true;
  });

  it('should be able to add and remove modifiers', () => {
    testPlayer.combat.addSpeedMod({
      name:   'haste',
      effect: speed => speed / 2
    });
    const numberOfSpeedMods = Object.keys(testPlayer.combat.speedMods).length;
    expect(numberOfSpeedMods).to.equal(1);
  });

  it('should be able to apply modifiers', () => {
    const speed = testPlayer.combat.getAttackSpeed();
    const expected = 4375;
    expect(speed).to.equal(expected);
  });

  it('should stack modifiers', () => {
    testPlayer.combat.addSpeedMod({
      name: 'slow',
      effect: speed => speed * 2
    });
    const speed = testPlayer.combat.getAttackSpeed();
    const expected = 4375 * 2;
    expect(speed).to.equal(expected);
  });

  it('has a maximum for speed mod', () => {

  });

});
<commit_msg>Add test for removing effect and having maximum.<commit_after>const expect = require('chai').expect;

const Player = require('../../src/player.js').Player;
const Npc    = require('../../src/npcs.js').Npc;

const CombatUtil   = require('../../src/combat_util.js').CombatUtil;
const CombatHelper = require('../../src/combat_util.js').CombatHelper;

describe('Player/NPC Combat Helper', () => {
  const testPlayer = new Player();

  it('should create a new instance', () => {
    expect(testPlayer.combat instanceof CombatHelper).to.be.true;
  });

  it('should be able to add and remove modifiers', () => {
    testPlayer.combat.addSpeedMod({
      name:   'haste',
      effect: speed => speed / 2
    });
    const numberOfSpeedMods = Object.keys(testPlayer.combat.speedMods).length;
    expect(numberOfSpeedMods).to.equal(1);
  });

  it('should be able to apply modifiers', () => {
    const speed = testPlayer.combat.getAttackSpeed();
    const expected = 4375;
    expect(speed).to.equal(expected);
  });

  it('should stack modifiers', () => {
    testPlayer.combat.addSpeedMod({
      name: 'slow',
      effect: speed => speed * 2
    });
    const speed = testPlayer.combat.getAttackSpeed();
    const expected = 4375 * 2;
    expect(speed).to.equal(expected);
  });

  it('can remove mods, has a maximum for speed mod', () => {
    testPlayer.combat.removeSpeedMod('haste');
    const speed = testPlayer.combat.getAttackSpeed();
    const maximum = 10 * 1000;
    expect(speed).to.equal(maximum);
  });

});

{'fraction_non_alphanumeric': 0.17235252309879176, 'fraction_numerical': 0.010660980810234541, 'mean_word_length': 3.3108728943338437, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '2618699', 'n_tokens_mistral': 931, 'n_tokens_neox': 884, 'n_words': 191}