mirror of
https://github.com/cloudflare/vinext.git
synced 2026-09-14 19:04:59 +08:00
2bf68e906b
Vite+ is now in beta. https://voidzero.dev/posts/announcing-vite-plus-beta
36 lines
991 B
TypeScript
36 lines
991 B
TypeScript
import { describe, expect, it } from "vite-plus/test";
|
|
import { visibleMarkerMask } from "../apps/web/app/benchmarks/components/chart-points";
|
|
|
|
describe("benchmark chart point markers", () => {
|
|
it("shows only the boundaries of a repeated plateau", () => {
|
|
expect(visibleMarkerMask([5, 5, 5, 5])).toEqual([true, false, false, true]);
|
|
});
|
|
|
|
it("shows every non-repeated value", () => {
|
|
expect(visibleMarkerMask([1, 2, 3, 4])).toEqual([true, true, true, true]);
|
|
});
|
|
|
|
it("groups values that have the same displayed value", () => {
|
|
const formatValue = (value: number) => value.toFixed(1);
|
|
|
|
expect(visibleMarkerMask([117.21, 117.22, 117.24, 117.31], formatValue)).toEqual([
|
|
true,
|
|
false,
|
|
true,
|
|
true,
|
|
]);
|
|
});
|
|
|
|
it("treats missing values as plateau boundaries", () => {
|
|
expect(visibleMarkerMask([null, 4, 4, null, 4, 4, 4])).toEqual([
|
|
false,
|
|
true,
|
|
true,
|
|
false,
|
|
true,
|
|
false,
|
|
true,
|
|
]);
|
|
});
|
|
});
|