Commit 96d73699 authored by Joe Ziemba's avatar Joe Ziemba
Browse files

fix tests, 113 migration

parent 7c9bbe53
export const BUILDER_VERSION = "1.2.0"
export const PUBLISHED_ON = "10/2/2021"
export const BUILDER_VERSION = "1.1.3"
export const PUBLISHED_ON = "10/16/2021"
......@@ -81,10 +81,6 @@ const hpTests = [
},
{
source: "Dwarf",
ability: "Constitution",
},
{
source: "Level_1",
level: 1,
ability: "Constitution",
},
......@@ -105,15 +101,11 @@ const hpTests = [
},
{
source: "Dwarf",
ability: "Constitution",
},
{
source: "Level_1",
level: 1,
ability: "Constitution",
},
],
correctHP: 10 + (8 + 2) + (8 + 2) + (8 + 2) + (8 + 2) + (8 + 3),
correctHP: 10 + 8 * 5 + 2 * 5,
},
{
testName: "lv 10 character with 3 CON boost",
......@@ -128,20 +120,22 @@ const hpTests = [
ability: "Constitution",
},
{
source: "Level_1",
level: 1,
source: "Level_5",
level: 5,
ability: "Constitution",
},
{
source: "Level_10",
level: 10,
ability: "Constitution",
},
{
source: "Level_15",
level: 15,
ability: "Constitution",
},
],
correctHP: 97,
correctHP: 10 * 8 + 4 + 5 * 2 + 3,
},
{
testName: "lv 10 character with 3 CON boost and Flaw",
......@@ -156,16 +150,18 @@ const hpTests = [
ability: "Constitution",
},
{
source: "Level_1",
level: 1,
source: "Level_5",
level: 5,
ability: "Constitution",
},
{
source: "Level_10",
level: 10,
ability: "Constitution",
},
{
source: "Level_15",
level: 15,
ability: "Constitution",
},
],
......@@ -176,7 +172,7 @@ const hpTests = [
ability: "Constitution",
},
],
correctHP: 87,
correctHP: 10 * 8 + 5 + 2,
},
{
testName: "lv 15 character with 4 CON boosts",
......@@ -191,16 +187,18 @@ const hpTests = [
ability: "Constitution",
},
{
source: "Level_1",
level: 1,
source: "Level_5",
level: 5,
ability: "Constitution",
},
{
source: "Level_10",
level: 10,
ability: "Constitution",
},
{
source: "Level_15",
level: 15,
ability: "Constitution",
},
],
......@@ -300,9 +298,9 @@ describe("calculatePerception", () => {
class: {
perceptionBoosts: [
{ type: "ANY_1", level: 1, proficiency: 2 },
{ type: "ANY_4", proficiency: 4 },
{ type: "ANY_6", proficiency: 6 },
{ type: "ANOTHER_6", proficiency: 10 },
{ type: "ANY_4", level: 4, proficiency: 4 },
{ type: "ANY_6", level: 6, proficiency: 6 },
{ type: "ANOTHER_6", level: 6, proficiency: 10 },
],
},
}
......
......@@ -102,6 +102,7 @@ export const Alchemist = {
ability: Abilities.INT,
source: nameOfClass,
id: nameOfClass + "-ability-1",
level: 1,
},
],
}
......@@ -94,6 +94,6 @@ export const Barbarian = {
},
]),
abilityBoosts: [
{ ability: Abilities.STR, source: nameOfClass, id: "Barb1" },
{ ability: Abilities.STR, source: nameOfClass, id: "Barb1", level: 1 },
],
}
......@@ -88,7 +88,7 @@ export const Bard = {
},
defenses: { unarmored: Proficiencies.TRAINED },
abilityBoosts: [
{ ability: Abilities.CHA, source: nameOfClass, id: "Bard1" },
{ ability: Abilities.CHA, source: nameOfClass, id: "Bard1", level: 1 },
],
skillBoosts: generateSkillBoosts([
{
......
......@@ -72,7 +72,15 @@ export function v1_1_1(character) {
character.builderVersion = "1.1.1"
}
function v1_3_0(character) {
character.feats.forEach((feat) => {
feat.level = +feat.type.split("_")[1]
})
character.builderVersion = "1.1.3"
}
export function migrateToLatest(character) {
if (!character.builderVersion) character.builderVersion = "0"
if (character.builderVersion < "1.0.1") {
v1_0_1(character)
character.builderVersion = "1.0.1"
......@@ -81,4 +89,7 @@ export function migrateToLatest(character) {
if (character.builderVersion < "1.1.1") {
v1_1_1(character)
}
if (character.builderVersion < "1.1.3") {
v1_3_0(character)
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment