feat(engine): costs on start, unlock checks, queue completion advancement
This commit is contained in:
@@ -86,7 +86,8 @@ describe('applyOfflineProgress()', () => {
|
||||
startAction(state, content, 'forage'); // 3000ms per gold
|
||||
const credited = applyOfflineProgress(state, content, 1000, 1000 + 9000); // 9s
|
||||
expect(credited).toBe(9000);
|
||||
expect(state.resources.gold).toBe(3); // 9000 / 3000
|
||||
expect(state.resources.gold).toBe(1); // one completion then idle
|
||||
expect(state.activeActionId).toBeNull();
|
||||
});
|
||||
|
||||
it('credits nothing when the clock did not advance', () => {
|
||||
@@ -103,6 +104,7 @@ describe('applyOfflineProgress()', () => {
|
||||
startAction(state, content, 'forage');
|
||||
const credited = applyOfflineProgress(state, content, 0, 10_000_000, 6000);
|
||||
expect(credited).toBe(6000);
|
||||
expect(state.resources.gold).toBe(2); // 6000 / 3000
|
||||
expect(state.resources.gold).toBe(1); // one completion then idle
|
||||
expect(state.activeActionId).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user