Forge success label and real progress bar tied to server compile stages.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled

Replace Dispensed with Forged in the reveal modal, poll builder/progress with indeterminate-until-first-byte UX, and emit interpolated compile progress during long garble builds.
This commit is contained in:
AetherForge
2026-06-08 19:48:24 -07:00
parent 0c7b676e23
commit 6ab43a468b
12 changed files with 273 additions and 147 deletions

View File

@@ -0,0 +1,48 @@
/**
* @vitest-environment happy-dom
*/
import { describe, expect, it } from 'vitest';
import { cleanup, render, screen } from '@testing-library/react';
import ForgeProgressBar, {
FORGE_INITIAL_STAGE,
isForgeProgressIndeterminate,
} from './ForgeProgressBar';
describe('isForgeProgressIndeterminate', () => {
it('is indeterminate before server reports progress', () => {
expect(isForgeProgressIndeterminate(FORGE_INITIAL_STAGE, 0)).toBe(true);
expect(isForgeProgressIndeterminate('', 0)).toBe(true);
});
it('is determinate once server reports pct or stage advances', () => {
expect(isForgeProgressIndeterminate('Compiling agent', 20)).toBe(false);
expect(isForgeProgressIndeterminate(FORGE_INITIAL_STAGE, 5)).toBe(false);
});
});
describe('ForgeProgressBar', () => {
it('renders nothing when not building', () => {
const { container } = render(
<ForgeProgressBar building={false} stage="" progress={0} />,
);
expect(container.firstChild).toBeNull();
});
it('shows indeterminate track before server progress', () => {
const { container } = render(
<ForgeProgressBar building stage={FORGE_INITIAL_STAGE} progress={0} />,
);
expect(screen.getByText('…')).toBeInTheDocument();
expect(container.querySelector('.forge-progress-track.indeterminate')).toBeTruthy();
cleanup();
});
it('shows server stage and pct when progress is reported', () => {
const { container } = render(
<ForgeProgressBar building stage="Compiling agent" progress={42} />,
);
expect(screen.getByText('Compiling agent')).toBeInTheDocument();
expect(screen.getByText('42%')).toBeInTheDocument();
expect(container.querySelector('.forge-progress-track.indeterminate')).toBeNull();
});
});