fix: encounter data assignment
This commit is contained in:
@@ -287,19 +287,36 @@ describe('generatePointCrawlMap', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('should assign encounters to nodes', () => {
|
||||
it('should assign encounters to all non-Start/End nodes', () => {
|
||||
const map = generatePointCrawlMap(456);
|
||||
|
||||
let nodesWithEncounter = 0;
|
||||
for (const node of map.nodes.values()) {
|
||||
if (node.encounter) {
|
||||
nodesWithEncounter++;
|
||||
expect(node.encounter.name).toBeTruthy();
|
||||
expect(node.encounter.description).toBeTruthy();
|
||||
if (node.type === MapNodeType.Start || node.type === MapNodeType.End) {
|
||||
// Start and End nodes should not have encounters
|
||||
expect(node.encounter).toBeUndefined();
|
||||
} else {
|
||||
// All other nodes (minion/elite/event/camp/shop/curio) must have encounters
|
||||
expect(node.encounter, `Node ${node.id} (${node.type}) should have encounter data`).toBeDefined();
|
||||
expect(node.encounter!.name).toBeTruthy();
|
||||
expect(node.encounter!.description).toBeTruthy();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
expect(nodesWithEncounter).toBeGreaterThan(0);
|
||||
it('should assign encounters to all nodes across multiple seeds', () => {
|
||||
// Test multiple seeds to ensure no random failure
|
||||
for (let seed = 0; seed < 20; seed++) {
|
||||
const map = generatePointCrawlMap(seed);
|
||||
|
||||
for (const node of map.nodes.values()) {
|
||||
if (node.type === MapNodeType.Start || node.type === MapNodeType.End) {
|
||||
continue;
|
||||
}
|
||||
expect(node.encounter, `Seed ${seed}: Node ${node.id} (${node.type}) missing encounter`).toBeDefined();
|
||||
expect(node.encounter!.name).toBeTruthy();
|
||||
expect(node.encounter!.description).toBeTruthy();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('should minimize same-layer repetitions in wild layer pairs', () => {
|
||||
|
||||
Reference in New Issue
Block a user