{"size": 1269, "ext": "js", "max_stars_repo_path": "__tests__/Character.test.js", "max_stars_repo_name": "FaisalRana/actually-final-fantasy", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "__tests__/Character.test.js", "max_issues_repo_name": "FaisalRana/actually-final-fantasy", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "__tests__/Character.test.js", "max_forks_repo_name": "FaisalRana/actually-final-fantasy", "max_forks_repo_forks_event_min_datetime": "2021-03-07T23:50:50.000Z", "max_forks_repo_forks_event_max_datetime": "2021-03-09T03:10:24.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 3, "avg_line_length": 31.725, "max_line_length": 95, "alphanum_fraction": 0.621749409}
import Character from '../src/js/Character.js';

describe('Character', () => {

  let Cloud;
  
  beforeEach(() => {
    Cloud = new Character("Cloud", "Soldier", 12, 7, 7, 4);
  });

  test('It should create a new character with stats at level 1', () => {
    expect(Cloud.name).toEqual("Cloud");
    expect(Cloud.characterClass).toEqual("Soldier");
    expect(Cloud.hitPoints).toEqual(12);
    expect(Cloud.strength).toEqual(7);
    expect(Cloud.toughness).toEqual(7);
    expect(Cloud.mind).toEqual(4);
    expect(Cloud.level).toEqual(1);
    expect(Cloud.equipment).toEqual({});
    expect(Cloud.buffs).toEqual({});
  });

  test('It should add a level to an existing character', () => {
    Cloud.levelUp();
    expect(Cloud.level).toEqual(2);
  });
  
  test('It should add an item to inventory', () => {
    let busterSword = {name: "Buster Sword", bonus:"+1"}
    Cloud.addItemToInventory(busterSword);
    expect(Cloud.equipment).toEqual({"Buster Sword": {"bonus": "+1", "name": "Buster Sword"}});
  });

  test('It should add a type and bonus to buff', () => {
    let strengthBuff = {type: "Strength Buff", bonus:"+5"}
    Cloud.buffAdd(strengthBuff);
    expect(Cloud.buffs).toEqual({"Strength Buff": {"type": "Strength Buff", "bonus": "+5"}});
  }); 
}); 
