diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-16 14:55:26 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-16 14:55:26 +0200 |
| commit | df7c9b5130ba193fc918a947a461f2a70dc2dd3c (patch) | |
| tree | 0366e0b60338e268d758511621b9adf721be8322 /web/frontend/ride-detail-logic.test.ts | |
| parent | 53ab332e6d2afe9818914e0026310e4cadcc4202 (diff) | |
fix(web): use Cotacol for climb difficulty
Diffstat (limited to 'web/frontend/ride-detail-logic.test.ts')
| -rw-r--r-- | web/frontend/ride-detail-logic.test.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/web/frontend/ride-detail-logic.test.ts b/web/frontend/ride-detail-logic.test.ts index 024f018..b848f7e 100644 --- a/web/frontend/ride-detail-logic.test.ts +++ b/web/frontend/ride-detail-logic.test.ts @@ -1,10 +1,11 @@ import test from "node:test"; import assert from "node:assert/strict"; import { - categoryForScore, + categoryForCotacol, climbMetrics, cotacolForClimb, elevationAtDistance, + formatClimbLabel, formatDistance, formatElevation, nearestPointIndex, @@ -28,7 +29,7 @@ test("interpolates elevation between route points", () => { assert.equal(elevationAtDistance(points, 2, 250), 120); }); -test("calculates climb metrics with the Cotacol score", () => { +test("calculates climb metrics with Cotacol", () => { const metrics = climbMetrics(points, { startIndex: 0, endIndex: 3 }); assert.ok(metrics); @@ -36,7 +37,12 @@ test("calculates climb metrics with the Cotacol score", () => { assert.equal(metrics.elevationGain, 20); assert.equal(metrics.slope, 8); assert.equal(metrics.cotacol, cotacolForClimb(points, 0, 3)); - assert.equal(metrics.category, categoryForScore(metrics.score)); + assert.equal(metrics.category, categoryForCotacol(metrics.cotacol)); +}); + +test("formats profile climb labels with Cotacol", () => { + assert.equal(formatClimbLabel("", "Cat 4", 45.9), "Cat 4 45.9"); + assert.equal(formatClimbLabel("Col de Test", "Cat 4", 45.9), "Col de Test"); }); test("formats profile labels consistently", () => { |