feat: recreate Prestige tab with insight upgrades, memories, pacts, and loop reset
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m19s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m19s
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
// ─── Test: PrestigeTab barrel export ───────────────────────────────────────────
|
||||
|
||||
describe('PrestigeTab module structure', () => {
|
||||
it('exports PrestigeTab from barrel index', async () => {
|
||||
const mod = await import('./PrestigeTab');
|
||||
expect(mod.PrestigeTab).toBeDefined();
|
||||
expect(typeof mod.PrestigeTab).toBe('function');
|
||||
});
|
||||
|
||||
it('PrestigeTab has correct displayName', async () => {
|
||||
const { PrestigeTab } = await import('./PrestigeTab');
|
||||
expect(PrestigeTab.displayName).toBe('PrestigeTab');
|
||||
});
|
||||
});
|
||||
|
||||
// ─── Test: Barrel export includes PrestigeTab ──────────────────────────────────
|
||||
|
||||
describe('Tab barrel export', () => {
|
||||
it('includes PrestigeTab in the tabs index', async () => {
|
||||
const mod = await import('@/components/game/tabs');
|
||||
expect(mod.PrestigeTab).toBeDefined();
|
||||
expect(typeof mod.PrestigeTab).toBe('function');
|
||||
});
|
||||
});
|
||||
|
||||
// ─── Test: Prestige upgrade definitions ────────────────────────────────────────
|
||||
|
||||
describe('Prestige upgrade definitions', () => {
|
||||
it('has exactly 14 prestige upgrades', async () => {
|
||||
const { PRESTIGE_DEF } = await import('@/lib/game/constants/prestige');
|
||||
expect(Object.keys(PRESTIGE_DEF).length).toBe(14);
|
||||
});
|
||||
|
||||
it('all upgrades have required fields', async () => {
|
||||
const { PRESTIGE_DEF } = await import('@/lib/game/constants/prestige');
|
||||
for (const [id, def] of Object.entries(PRESTIGE_DEF)) {
|
||||
expect(def.name).toBeTruthy();
|
||||
expect(def.desc).toBeTruthy();
|
||||
expect(def.max).toBeGreaterThan(0);
|
||||
expect(def.cost).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
|
||||
it('all 14 expected upgrade IDs are present', async () => {
|
||||
const { PRESTIGE_DEF } = await import('@/lib/game/constants/prestige');
|
||||
const expectedIds = [
|
||||
'manaWell', 'manaFlow', 'deepMemory', 'insightAmp', 'spireKey',
|
||||
'temporalEcho', 'steadyHand', 'ancientKnowledge', 'elementalAttune',
|
||||
'spellMemory', 'guardianPact', 'quickStart', 'elemStart',
|
||||
'unlockedManaTypeCapacity',
|
||||
];
|
||||
for (const id of expectedIds) {
|
||||
expect(PRESTIGE_DEF[id]).toBeDefined();
|
||||
}
|
||||
});
|
||||
|
||||
it('upgrade costs are positive integers', async () => {
|
||||
const { PRESTIGE_DEF } = await import('@/lib/game/constants/prestige');
|
||||
for (const def of Object.values(PRESTIGE_DEF)) {
|
||||
expect(Number.isInteger(def.cost)).toBe(true);
|
||||
expect(def.cost).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
|
||||
it('upgrade max levels are positive integers', async () => {
|
||||
const { PRESTIGE_DEF } = await import('@/lib/game/constants/prestige');
|
||||
for (const def of Object.values(PRESTIGE_DEF)) {
|
||||
expect(Number.isInteger(def.max)).toBe(true);
|
||||
expect(def.max).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ─── Test: Prestige store shape ────────────────────────────────────────────────
|
||||
|
||||
describe('Prestige store', () => {
|
||||
it('usePrestigeStore is importable', async () => {
|
||||
const mod = await import('@/lib/game/stores');
|
||||
expect(mod.usePrestigeStore).toBeDefined();
|
||||
expect(typeof mod.usePrestigeStore).toBe('function');
|
||||
});
|
||||
});
|
||||
|
||||
// ─── Test: File size limit ─────────────────────────────────────────────────────
|
||||
|
||||
describe('File size limits (400 lines max)', () => {
|
||||
it('PrestigeTab.tsx is under 400 lines', async () => {
|
||||
const fs = await import('fs');
|
||||
const path = await import('path');
|
||||
const filePath = path.join(__dirname, 'PrestigeTab.tsx');
|
||||
const content = fs.readFileSync(filePath, 'utf-8');
|
||||
const lines = content.split('\n').length;
|
||||
expect(lines).toBeLessThan(400);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user