Tracker made in React for keeping track of HP and MP and so on.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
fabula-ultima-react/src/model/Character.test.ts

19 lines
909 B

import {CharacterHealth, CharacterHealthLevelList} from "./Character";
describe('CharacterHealth', function () {
test("covers all possible values of health, descending", () => {
let nextBound = Number.POSITIVE_INFINITY
let nextBoundInclusive = null
for (const level of CharacterHealthLevelList) {
expect(level.maxPercentage ?? Number.POSITIVE_INFINITY).toEqual(nextBound)
expect(level.maxInclusive).toEqual(nextBoundInclusive)
nextBound = level.minPercentage ?? Number.NEGATIVE_INFINITY
nextBoundInclusive = typeof level.minInclusive === "boolean" ? !level.minInclusive : null
if (Number.isFinite(nextBound)) {
expect(typeof level.minInclusive).toEqual("boolean")
}
}
expect(nextBound).toEqual(Number.NEGATIVE_INFINITY)
expect(nextBoundInclusive).toBeNull()
})
});