longevity: #14 unità A, cambi di test solo fra alternative
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,56 @@ describe('andamentoTest: cambio di test dentro la stessa sezione (Trazione)', ()
|
||||
});
|
||||
});
|
||||
|
||||
describe('andamentoTest: i cambi valgono solo fra alternative vere, non nell\'intera sezione', () => {
|
||||
it('Strumenti: massa grassa poi solo WHR non e\' un cambio (test non alternativi)', () => {
|
||||
const db = dbPronto();
|
||||
const s1 = checkup(db, '2026-01-10');
|
||||
registraMisure(db, s1, 'manuale', [{ test_id: 'f_grasso_pct', valore_num: 20 }]);
|
||||
const s2 = checkup(db, '2026-03-10');
|
||||
registraMisure(db, s2, 'manuale', [{ test_id: 'f_whr', valore_num: 0.9 }]); // niente massa grassa
|
||||
|
||||
const sezioni = andamentoTest(db, 'ISL-0001', { trainer: true });
|
||||
const strumenti = sezioni.find((s) => s.titolo === 'Strumenti')!;
|
||||
expect(strumenti.grafici.map((g) => g.titolo).sort()).toEqual(['Massa grassa', 'Rapporto vita-fianchi (WHR)']);
|
||||
expect(strumenti.cambi).toEqual([]);
|
||||
});
|
||||
|
||||
it('Mobilità: back scratch in ogni sessione, sit and reach solo in una, non e\' un cambio', () => {
|
||||
const db = dbPronto();
|
||||
const s1 = checkup(db, '2026-01-10');
|
||||
registraMisure(db, s1, 'manuale', [
|
||||
{ test_id: 'f_back_scratch_dx_cm', valore_num: -5 },
|
||||
{ test_id: 'f_back_scratch_sx_cm', valore_num: -6 },
|
||||
]);
|
||||
const s2 = checkup(db, '2026-03-10');
|
||||
registraMisure(db, s2, 'manuale', [
|
||||
{ test_id: 'f_back_scratch_dx_cm', valore_num: -4 },
|
||||
{ test_id: 'f_back_scratch_sx_cm', valore_num: -5 },
|
||||
{ test_id: 'f_sit_reach_cm', valore_num: 2 }, // solo in questa sessione
|
||||
]);
|
||||
|
||||
const sezioni = andamentoTest(db, 'ISL-0001', { trainer: true });
|
||||
const mobilita = sezioni.find((s) => s.titolo === 'Mobilità')!;
|
||||
expect(mobilita.grafici.map((g) => g.titolo).sort()).toEqual(['Back scratch', 'Sit and reach']);
|
||||
expect(mobilita.cambi).toEqual([]);
|
||||
});
|
||||
|
||||
it('Presa: handgrip storico poi handgrip dx/sx e\' un vero cambio (alternativa dismessa)', () => {
|
||||
const db = dbPronto();
|
||||
const s1 = checkup(db, '2026-01-10');
|
||||
registraMisure(db, s1, 'manuale', [{ test_id: 'f_handgrip_kg', valore_num: 30 }]);
|
||||
const s2 = checkup(db, '2026-03-10');
|
||||
registraMisure(db, s2, 'manuale', [
|
||||
{ test_id: 'f_handgrip_dx_kg', valore_num: 32 },
|
||||
{ test_id: 'f_handgrip_sx_kg', valore_num: 28 },
|
||||
]);
|
||||
|
||||
const sezioni = andamentoTest(db, 'ISL-0001', { trainer: true });
|
||||
const presa = sezioni.find((s) => s.titolo === 'Presa')!;
|
||||
expect(presa.cambi).toEqual([{ data: '2026-03-10', da: 'Handgrip (storico)', a: 'Handgrip' }]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('andamentoTest: solo misure valide', () => {
|
||||
it('fuori range non confermata è esclusa; confermata entra', () => {
|
||||
const db = dbPronto();
|
||||
|
||||
Reference in New Issue
Block a user