- Integrated leveling and economy commands, including XP management and shop interactions. - Added context menu support for utility commands, improving user interaction options. - Updated command registration to include new commands and context menus, enhancing overall functionality. - Improved logging to track the registration of commands and context menus. - Refactored interaction handling to accommodate new command types and ensure smooth execution.
23 lines
736 B
TypeScript
23 lines
736 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { levelFromXp, progressInLevel, totalXpForLevel, xpForNextLevel } from './phase3.js';
|
|
|
|
describe('phase3 xp helpers', () => {
|
|
it('computes xp for next level', () => {
|
|
expect(xpForNextLevel(0)).toBe(100);
|
|
expect(xpForNextLevel(1)).toBe(155);
|
|
});
|
|
|
|
it('derives level from xp', () => {
|
|
expect(levelFromXp(0)).toBe(0);
|
|
expect(levelFromXp(100)).toBe(1);
|
|
expect(levelFromXp(totalXpForLevel(5))).toBe(5);
|
|
});
|
|
|
|
it('reports progress in current level', () => {
|
|
const progress = progressInLevel(totalXpForLevel(2) + 10);
|
|
expect(progress.level).toBe(2);
|
|
expect(progress.intoLevel).toBe(10);
|
|
expect(progress.needed).toBe(xpForNextLevel(2));
|
|
});
|
|
});
|