API+App: podsumowanie po ukonczeniu sesji - POST /sessions/:id/complete zwraca summary (czas/serie/powt./tonaz, killstreak + centyl passy, tonaz vs srednie 30 dni; niekrytyczne = null), celebracyjne okno w DayExecution i helpery format (swagger, unit, e2e)

This commit is contained in:
tisachi
2026-11-05 22:28:30 +01:00
parent 6e0f81325e
commit e94cf72e15
17 changed files with 766 additions and 20 deletions

View File

@@ -545,6 +545,21 @@ describe('sessions routes', () => {
.post(`/api/v1/sessions/${sessionId}/complete`)
.set('Authorization', `Bearer ${token}`);
expect(res.status).toBe(200);
expect(res.body.ok).toBe(true);
// podsumowanie celebracyjne: liczby sesji + killstreak + średnie tonażu
const sm = res.body.summary;
expect(sm).toBeTruthy();
expect(typeof sm.durationSec).toBe('number');
expect(sm.exercises).toBeGreaterThanOrEqual(1);
expect(sm.sets).toBeGreaterThanOrEqual(2);
expect(sm.reps).toBeGreaterThan(0);
expect(typeof sm.tonnageKg).toBe('number');
expect(sm.killstreak.current).toBeGreaterThanOrEqual(0);
expect(sm.killstreak).toHaveProperty('best');
expect(sm.killstreak).toHaveProperty('newRecord');
expect(sm.volume).toHaveProperty('ownAvgKg');
expect(sm.volume).toHaveProperty('globalAvgKg');
const day = await app.get(`/api/v1/days/${dayId}`).set('Authorization', `Bearer ${token}`);
expect(day.body.day.status).toBe('COMPLETED');