Add ESLint, Add worker utils

This commit is contained in:
uwap 2025-12-21 09:48:53 +01:00
parent a64f40b6cc
commit c026087af1
29 changed files with 3042 additions and 1734 deletions

View file

@ -1,13 +1,16 @@
import BodyPartCosts from '../Constants/BodyPartCosts';
import * as Workers from './index';
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);
}
});
}
});
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);
}
});
}
});