diff --git a/app/src/pages/profile/ProfileBodyParameters.tsx b/app/src/pages/profile/ProfileBodyParameters.tsx
index 3460552..507b2c6 100644
--- a/app/src/pages/profile/ProfileBodyParameters.tsx
+++ b/app/src/pages/profile/ProfileBodyParameters.tsx
@@ -354,7 +354,7 @@ export default function ProfileBodyParameters() {
// menu top: selektor miesiąca (filtr po dacie) + akcja otwierająca modal w treści strony
useTopbar({
- title: 'Profil — parametry ciała',
+ title: 'Parametry ciała',
back: '/profile',
dateFilter: ,
filterActive: month !== '',
@@ -510,18 +510,6 @@ export default function ProfileBodyParameters() {
)
}
- actions={
-
- }
>
{weightPoints.length === 0 ? (
{
const url = String(input);
const method = init?.method || 'GET';
- if (url.includes('/auth/login')) return jsonResponse(200, { user: USER, accessToken: 'tok-1' });
+ if (url.includes('/auth/login'))
+ return jsonResponse(200, { user: USER, accessToken: 'tok-1' });
if (url.includes('/auth/refresh'))
return jsonResponse(401, { error: { code: 'UNAUTHORIZED', message: 'no cookie' } });
if (method === 'DELETE' && url.includes('/me/body-parameters/weight/')) {
const id = url.split('/').pop()!;
const idx = weightState.findIndex((w) => w.id === id);
- if (idx < 0) return jsonResponse(404, { error: { code: 'NOT_FOUND', message: 'not found' } });
+ if (idx < 0)
+ return jsonResponse(404, { error: { code: 'NOT_FOUND', message: 'not found' } });
weightState.splice(idx, 1);
deleted.push({ kind: 'weight', id });
return new Response(null, { status: 204 });
@@ -65,13 +67,17 @@ function mockApi(
if (method === 'DELETE' && url.includes('/me/body-parameters/circumference/')) {
const id = url.split('/').pop()!;
const idx = circState.findIndex((c) => c.id === id);
- if (idx < 0) return jsonResponse(404, { error: { code: 'NOT_FOUND', message: 'not found' } });
+ if (idx < 0)
+ return jsonResponse(404, { error: { code: 'NOT_FOUND', message: 'not found' } });
circState.splice(idx, 1);
deleted.push({ kind: 'circumference', id });
return new Response(null, { status: 204 });
}
if (url.includes('/me/body-parameters')) {
- const byName = new Map();
+ const byName = new Map<
+ string,
+ { name: string; points: { id: string; value: number; date: string }[] }
+ >();
for (const c of circState) {
const entry = byName.get(c.name) ?? { name: c.name, points: [] };
entry.points.push({ id: c.id, value: c.value, date: c.date });
@@ -80,12 +86,18 @@ function mockApi(
return jsonResponse(200, { weight: weightState, circumferences: [...byName.values()] });
}
if (url.includes('/me/history')) return jsonResponse(200, { sessions: [] });
- if (url.includes('/me/focus-chain')) return jsonResponse(200, { priorities: [], exclusions: [] });
+ if (url.includes('/me/focus-chain'))
+ return jsonResponse(200, { priorities: [], exclusions: [] });
if (url.includes('/me')) return jsonResponse(200, { user: USER, memberships: [] });
if (url.includes('/focus-areas')) return jsonResponse(200, { focusAreas: [] });
if (url.includes('/gyms')) return jsonResponse(200, { gyms: [] });
if (url.includes('/dashboard'))
- return jsonResponse(200, { killstreak: 0, activePlan: null, nextTraining: null, progress: null });
+ return jsonResponse(200, {
+ killstreak: 0,
+ activePlan: null,
+ nextTraining: null,
+ progress: null,
+ });
if (url.includes('/exercises')) return jsonResponse(200, { exercises: [] });
if (url.includes('/plans')) return jsonResponse(200, { plans: [] });
if (url.includes('/calendar')) return jsonResponse(200, { month: '2026-08', days: [] });
@@ -107,8 +119,10 @@ async function loginToProfile(user: userEvent.User) {
expect(await screen.findByRole('heading', { name: 'Profil' })).toBeInTheDocument();
// body parameters live on their own subpage — open it via the tile
await user.click(await screen.findByRole('link', { name: /Parametry ciała/ }));
- // tytuł podstrony jest tylko w topmenu (nagłówek Layout)
- expect(await screen.findByRole('heading', { name: 'Profil — parametry ciała' })).toBeInTheDocument();
+ // wspólna nazwa sekcji: topbar (h1) = PageHeader (h2)
+ expect(
+ await screen.findByRole('heading', { name: 'Parametry ciała', level: 1 }),
+ ).toBeInTheDocument();
}
function renderApp() {
@@ -268,18 +282,21 @@ describe('Profile — body parameter removal', () => {
expect(screen.getByRole('button', { name: 'Poprzedni miesiąc z danymi' })).toBeDisabled();
});
- it('pokaże deltę wagi w wybranym miesiącu i szybkie „+ Waga” w nagłówku karty', async () => {
+ it('pokaże deltę wagi w wybranym miesiącu, a dodanie wagi jest tylko w topmenu', async () => {
mockApi();
const user = userEvent.setup();
renderApp();
await loginToProfile(user);
- // delta: 81.8 (15.08) − 82.5 (01.08) = −0.7 kg (spadek)
+ // delta: 81.8 (15.08) − 82.5 (01.08) = −0,7 kg (spadek)
expect(await screen.findByText('82.5 kg')).toBeInTheDocument();
expect(screen.getByText('−0,7 kg w tym miesiącu')).toBeInTheDocument();
- // szybkie dodanie wagi z nagłówka karty otwiera modal na zakładce Waga
- await user.click(screen.getByRole('button', { name: '+ Waga' }));
+ // 1 kontrolka = 1 miejsce: w nagłówku karty brak przycisku „+ Waga”
+ expect(screen.queryByRole('button', { name: '+ Waga' })).not.toBeInTheDocument();
+
+ // dodanie wagi wyłącznie z topmenu (modal otwiera się na zakładce Waga)
+ await user.click(screen.getByRole('button', { name: 'Dodaj pomiar' }));
expect(await screen.findByRole('dialog')).toBeInTheDocument();
expect(screen.getByPlaceholderText('waga (kg)')).toBeInTheDocument();
});