✨Feature: implement loot resolution system with gold and item tracking from defeated creatures #11
@@ -269,4 +269,46 @@ describe("run state flow", () => {
|
|||||||
|
|
||||||
expect(isCurrentRoomCombatReady(run)).toBe(true);
|
expect(isCurrentRoomCombatReady(run)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("lists available traversable exits for the current room", () => {
|
||||||
|
const run = createRunState({
|
||||||
|
content: sampleContentPack,
|
||||||
|
campaignId: "campaign.1",
|
||||||
|
adventurer: createAdventurer(),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(getAvailableMoves(run)).toEqual([
|
||||||
|
expect.objectContaining({
|
||||||
|
direction: "north",
|
||||||
|
generated: false,
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("travels through an unresolved exit, generates a room, and enters it", () => {
|
||||||
|
const run = createRunState({
|
||||||
|
content: sampleContentPack,
|
||||||
|
campaignId: "campaign.1",
|
||||||
|
adventurer: createAdventurer(),
|
||||||
|
at: "2026-03-15T14:00:00.000Z",
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = travelCurrentExit({
|
||||||
|
content: sampleContentPack,
|
||||||
|
run,
|
||||||
|
exitDirection: "north",
|
||||||
|
roller: createSequenceRoller([1, 1]),
|
||||||
|
at: "2026-03-15T14:05:00.000Z",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result.run.currentRoomId).toBe("room.level1.room.002");
|
||||||
|
expect(result.run.dungeon.levels["1"]!.discoveredRoomOrder).toEqual([
|
||||||
|
"room.level1.start",
|
||||||
|
"room.level1.room.002",
|
||||||
|
]);
|
||||||
|
expect(result.run.dungeon.levels["1"]!.rooms["room.level1.room.002"]!.discovery.entered).toBe(
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
expect(result.run.log[0]?.text).toContain("Travelled north");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user