fix: issues #221 #217 #225 #227 #224 #226 - crafting refunds, mana tracking, cancel slot, multi-element guardians, spell kill advance
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m59s

This commit is contained in:
2026-05-31 01:18:01 +02:00
parent e4f4b297e8
commit 6793461a9f
16 changed files with 263 additions and 63 deletions
@@ -126,13 +126,20 @@ describe('Tick Integration', () => {
expect(useManaStore.getState().rawMana).toBeLessThanOrEqual(100);
});
it('should not decrease totalManaGathered on tick', () => {
// Note: passive regen in tick() updates rawMana directly, not via addRawMana,
// so totalManaGathered only increases from gatherMana or combat loot.
// This is expected behavior — totalManaGathered tracks active gathering.
it('should increase totalManaGathered from meditation regen', () => {
// Passive meditation regen should count toward totalManaGathered
useManaStore.setState({ rawMana: 50, totalManaGathered: 5 });
useGameStore.getState().tick();
expect(useManaStore.getState().totalManaGathered).toBeGreaterThanOrEqual(5);
expect(useManaStore.getState().totalManaGathered).toBeGreaterThan(5);
});
it('should not count regen toward totalManaGathered when at cap', () => {
// Regen that would exceed max mana should not count toward totalManaGathered
useManaStore.setState({ rawMana: 100, totalManaGathered: 50 });
useGameStore.getState().tick();
// When rawMana equals or exceeds maxMana, no regen is added to totalManaGathered
// Use toBeCloseTo with tolerance for floating point drift from base regen calculations
expect(useManaStore.getState().totalManaGathered).toBeLessThanOrEqual(50.05);
});
});
@@ -304,13 +311,13 @@ describe('Tick Integration', () => {
expect(useGameStore.getState().hour).toBeCloseTo(1, 5);
});
it('should not lose totalManaGathered over ticks', () => {
it('should accumulate totalManaGathered from meditation over ticks', () => {
useManaStore.setState({ rawMana: 10, totalManaGathered: 42 });
for (let i = 0; i < 10; i++) {
useGameStore.getState().tick();
}
// totalManaGathered should stay at 42 (passive regen doesn't change it)
expect(useManaStore.getState().totalManaGathered).toBe(42);
// Passive meditation regen should now count toward totalManaGathered
expect(useManaStore.getState().totalManaGathered).toBeGreaterThan(42);
});
});