use dnd_character::Character;

#[tokio::test]
async fn test_parsing() {
    let character = r#"{
      "abilitiesScore": {
        "charisma": {
          "proficiency": false,
          "score": 13
        },
        "constitution": {
          "proficiency": false,
          "score": 12
        },
        "dexterity": {
          "proficiency": false,
          "score": 12
        },
        "intelligence": {
          "proficiency": false,
          "score": 11
        },
        "strength": {
          "proficiency": false,
          "score": 11
        },
        "wisdom": {
          "proficiency": false,
          "score": 14
        }
      },
      "age": 43,
      "alignmentIndex": "chaotic-good",
      "backgroundDescription": "asdasd",
      "backgroundIndex": "",
      "classes": {
        "warlock": [
          "warlock",
          {
            "abilitiesModifiers": {
              "charisma": {
                "proficiency": false,
                "score": 0
              },
              "constitution": {
                "proficiency": false,
                "score": 0
              },
              "dexterity": {
                "proficiency": false,
                "score": 0
              },
              "intelligence": {
                "proficiency": false,
                "score": 0
              },
              "strength": {
                "proficiency": false,
                "score": 0
              },
              "wisdom": {
                "proficiency": false,
                "score": 0
              }
            },
            "additionalFightingStyle": null,
            "fightingStyle": null,
            "level": 1,
            "spellCasting": null,
            "subclass": null
          }
        ]
      },
      "description": "dasdas",
      "experiencePoints": 0,
      "hp": 9,
      "inventory": {
        "Common Clothes": 1,
        "Crossbow Bolt": 1,
        "Empty Scroll": 1,
        "Ration": 1,
        "Rope": 1,
        "Tent": 1,
        "Torch": 1,
        "Waterskin": 1
      },
      "maxHp": 9,
      "money": 0,
      "name": "dfsdfsd",
      "other": [],
      "raceIndex": "human",
      "subraceIndex": ""
    }"#;

    let character: Character = serde_json::from_str(character).unwrap();

    assert_eq!(character.name, "dfsdfsd");
}