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.
19 lines
909 B
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()
|
|
})
|
|
|
|
}); |