mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-29 16:29:13 -04:00
Build 29095000
This commit is contained in:
parent
096f7d4abd
commit
4c324d211c
27 changed files with 500 additions and 1350 deletions
|
@ -1,38 +1,43 @@
|
|||
import conditions from "./unlockConditions.json"
|
||||
import levels from "./levels.json"
|
||||
import {rawUpgrades} from "../upgrades";
|
||||
import {getLevelUnlockCondition} from "../get_level_unlock_condition";
|
||||
import {UnlockCondition} from "../types";
|
||||
import conditions from "./unlockConditions.json";
|
||||
import levels from "./levels.json";
|
||||
import { rawUpgrades } from "../upgrades";
|
||||
import { getLevelUnlockCondition } from "../get_level_unlock_condition";
|
||||
import { UnlockCondition } from "../types";
|
||||
|
||||
describe("conditions", () => {
|
||||
it("defines conditions for existing levels only", () => {
|
||||
const conditionForMissingLevel=Object.keys(conditions).filter(levelName=>!levels.find(l=>l.name===levelName))
|
||||
expect(conditionForMissingLevel).toEqual([]);
|
||||
});
|
||||
it("defines conditions with existing upgrades only", () => {
|
||||
|
||||
const existingIds :Set<string>= new Set(rawUpgrades.map(u=>u.id));
|
||||
const missing:Set<string>=new Set();
|
||||
Object.values(conditions).forEach(({required,forbidden})=>{
|
||||
[...required,...forbidden].forEach(id=> {
|
||||
if(!existingIds.has(id))
|
||||
missing.add(id)
|
||||
})
|
||||
})
|
||||
|
||||
expect([...missing]).toEqual([]);
|
||||
it("defines conditions for existing levels only", () => {
|
||||
const conditionForMissingLevel = Object.keys(conditions).filter(
|
||||
(levelName) => !levels.find((l) => l.name === levelName),
|
||||
);
|
||||
expect(conditionForMissingLevel).toEqual([]);
|
||||
});
|
||||
it("defines conditions with existing upgrades only", () => {
|
||||
const existingIds: Set<string> = new Set(rawUpgrades.map((u) => u.id));
|
||||
const missing: Set<string> = new Set();
|
||||
Object.values(conditions).forEach(({ required, forbidden }) => {
|
||||
[...required, ...forbidden].forEach((id) => {
|
||||
if (!existingIds.has(id)) missing.add(id);
|
||||
});
|
||||
});
|
||||
|
||||
it("defines conditions for all levels", () => {
|
||||
const toAdd : Record<string,UnlockCondition>= {}
|
||||
levels.filter(l=>!l.name.startsWith('icon:')).forEach((l,li)=> {
|
||||
if(l.name in conditions) return
|
||||
toAdd[l.name]= getLevelUnlockCondition(li, l.name)
|
||||
})
|
||||
if(Object.keys(toAdd).length){
|
||||
console.debug('Missing hardcoded conditons\n\n'+ JSON.stringify(toAdd).slice(1,-1)+'\n\n')
|
||||
}
|
||||
expect(Object.keys(toAdd)).toEqual([]);
|
||||
});
|
||||
expect([...missing]).toEqual([]);
|
||||
});
|
||||
|
||||
})
|
||||
it("defines conditions for all levels", () => {
|
||||
const toAdd: Record<string, UnlockCondition> = {};
|
||||
levels
|
||||
.filter((l) => !l.name.startsWith("icon:"))
|
||||
.forEach((l, li) => {
|
||||
if (l.name in conditions) return;
|
||||
toAdd[l.name] = getLevelUnlockCondition(li, l.name);
|
||||
});
|
||||
if (Object.keys(toAdd).length) {
|
||||
console.debug(
|
||||
"Missing hardcoded conditons\n\n" +
|
||||
JSON.stringify(toAdd).slice(1, -1) +
|
||||
"\n\n",
|
||||
);
|
||||
}
|
||||
expect(Object.keys(toAdd)).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue