Add tests

This commit is contained in:
uwap 2022-12-31 09:04:15 +01:00
parent 3bd6b0ac2c
commit a64f40b6cc
11 changed files with 2252 additions and 21 deletions

View file

@ -0,0 +1,13 @@
import BodyPartCosts from '../Constants/BodyPartCosts';
import * as Workers from './index';
describe('Test Creep Workers', () => {
console.log(Workers.Clerk)
for (const [moduleName, worker] of Object.entries(Workers)) {
test(`${moduleName}: Body parts cost calculation is correct`, () => {
for (let cost = 0; cost < 1500; cost++) {
expect(worker.bodyDefinition(cost).map((x) => BodyPartCosts[x]).reduce((x, y) => x + y, 0)).toBeLessThanOrEqual(cost);
}
});
}
});