Skip to content

Commit 7f72280

Browse files
test: remove duplicate pareto ordering probes (#1231)
中文:删除五个重复、空断言或仅验证测试内排序的用例,保留各方向的精确前沿结果与渲染覆盖。
1 parent 6cea55e commit 7f72280

1 file changed

Lines changed: 0 additions & 57 deletions

File tree

‎packages/app/src/lib/chart-utils.test.ts‎

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -466,63 +466,6 @@ describe('getNestedYValue', () => {
466466
});
467467
});
468468

469-
// ---------------------------------------------------------------------------
470-
// Pareto front x-ordering — gradient labels require ascending x
471-
// ---------------------------------------------------------------------------
472-
describe('paretoFront x-ordering for gradient labels', () => {
473-
it('paretoFrontUpperRight returns points in ascending x order', () => {
474-
const points = [pt(3, 30), pt(1, 10), pt(2, 20)];
475-
const front = paretoFrontUpperRight(points);
476-
for (let i = 1; i < front.length; i++) {
477-
expect(front[i].x).toBeGreaterThanOrEqual(front[i - 1].x);
478-
}
479-
});
480-
481-
it('paretoFrontLowerRight returns points in descending x order', () => {
482-
// This is the documented behavior that causes gradient labels to break
483-
// when points are not re-sorted to ascending x.
484-
// Use data where y decreases as x decreases so multiple points land on front:
485-
// lower_right: sort desc x, push when y < minY
486-
const points = [pt(3, 20), pt(2, 15), pt(1, 10)];
487-
const front = paretoFrontLowerRight(points);
488-
expect(front.length).toBeGreaterThanOrEqual(2);
489-
// Verify descending order
490-
for (let i = 1; i < front.length; i++) {
491-
expect(front[i].x).toBeLessThanOrEqual(front[i - 1].x);
492-
}
493-
});
494-
495-
it('paretoFrontLowerRight sorted ascending fixes gradient label compatibility', () => {
496-
// Regression test: sorting the output of paretoFrontLowerRight by
497-
// ascending x ensures computeGradientStops gets a positive totalRange.
498-
const points = [pt(3, 20), pt(2, 15), pt(1, 10)];
499-
const front = paretoFrontLowerRight(points);
500-
expect(front.length).toBeGreaterThanOrEqual(2);
501-
// Apply the fix from ScatterGraph.tsx
502-
front.sort((a, b) => a.x - b.x);
503-
// Now ascending
504-
for (let i = 1; i < front.length; i++) {
505-
expect(front[i].x).toBeGreaterThanOrEqual(front[i - 1].x);
506-
}
507-
});
508-
509-
it('paretoFrontUpperLeft returns points in ascending x order', () => {
510-
const points = [pt(3, 10), pt(1, 30), pt(2, 20)];
511-
const front = paretoFrontUpperLeft(points);
512-
for (let i = 1; i < front.length; i++) {
513-
expect(front[i].x).toBeGreaterThanOrEqual(front[i - 1].x);
514-
}
515-
});
516-
517-
it('paretoFrontLowerLeft returns points in ascending x order', () => {
518-
const points = [pt(3, 30), pt(1, 10), pt(2, 20)];
519-
const front = paretoFrontLowerLeft(points);
520-
for (let i = 1; i < front.length; i++) {
521-
expect(front[i].x).toBeGreaterThanOrEqual(front[i - 1].x);
522-
}
523-
});
524-
});
525-
526469
// ===========================================================================
527470
// getHardwareKey
528471
// ===========================================================================

0 commit comments

Comments
 (0)