Stringify HP in tests for the toString functionality

main
Mari 3 years ago
parent 84c6744080
commit e354fbf8f6
  1. 4
      src/battlers/HitPoints.test.ts

@ -41,7 +41,7 @@ describe("hitPointsWithoutConfidenceToString", () => {
[{currentHealth: -25, maxHealth: 0, maxConfidence: -200}, "{Health: -25/0, Confidence: -/-/-200}"], [{currentHealth: -25, maxHealth: 0, maxConfidence: -200}, "{Health: -25/0, Confidence: -/-/-200}"],
] ]
pairs.forEach(([hp, expected]) => { pairs.forEach(([hp, expected]) => {
test(`for ${hp} = "${expected}"`, () => { test(`for ${JSON.stringify(hp)} = "${expected}"`, () => {
expect(hitPointsWithoutConfidenceToString(hp)).toStrictEqual(expected) expect(hitPointsWithoutConfidenceToString(hp)).toStrictEqual(expected)
}) })
}) })
@ -53,7 +53,7 @@ describe("hitPointsToString", () => {
[{currentHealth: -25, maxHealth: 0, maxConfidence: -200, currentConfidence: -15}, "{Health: -25/0, Confidence: -15/<err>/-200}"], [{currentHealth: -25, maxHealth: 0, maxConfidence: -200, currentConfidence: -15}, "{Health: -25/0, Confidence: -15/<err>/-200}"],
] ]
pairs.forEach(([hp, expected]) => { pairs.forEach(([hp, expected]) => {
test(`for ${hp} = "${expected}"`, () => { test(`for ${JSON.stringify(hp)} = "${expected}"`, () => {
expect(hitPointsToString(hp)).toStrictEqual(expected) expect(hitPointsToString(hp)).toStrictEqual(expected)
}) })
}) })

Loading…
Cancel
Save