Files
dawnline/web/tests/plot.test.ts
T
Aemeath 18e3013047
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions
Dawnline 0.17.0
- Redraw the admin's charts in the connection map's style: the live speed as lines, the last 30 days and a device's week as stacked download and upload bars, a device's days as a strip, data use as meters.
- Read any chart point by point with the pointer, a tap or the arrow keys; a day's tooltip compares it with the average and shows its download and upload.
- Show where a data limit leads at the recent pace: the week ahead on the meter, and when the limit fills or what a monthly one reaches by the reset.
- Make Speed now live, one point a second, on a person's page, in the People list and in an online person's card.
- Name every place an online person's devices connect from, and the city each device connects from now.
- Portal: read the month and the week by tap or arrow keys, see how a day compares with the others, the pace toward the data limit and how long the allowed hours still run.
- Send VPN clients' DNS to the LAN's DNS after its interceptors, so transparent proxies such as forkop also handle their lookups.
2026-11-02 09:48:31 +03:00

26 lines
776 B
TypeScript

import { describe, expect, it } from 'vitest';
import { smooth } from '../src/admin/ui/plot';
/** Every y a path's points and control points reach. */
const ys = (d: string) => [...d.matchAll(/(-?[\d.]+),(-?[\d.]+)/g)].map((m) => Number(m[2]));
describe('smooth line', () => {
it('never overshoots its points, so a quiet stretch stays flat', () => {
const pts: [number, number][] = [
[0, 40],
[10, 40],
[20, 2],
[30, 40],
[40, 40],
];
const y = ys(smooth(pts));
expect(Math.min(...y)).toBeGreaterThanOrEqual(2);
expect(Math.max(...y)).toBeLessThanOrEqual(40);
});
it('draws one point as a move and nothing as nothing', () => {
expect(smooth([[3, 4]])).toBe('M3.0,4.0');
expect(smooth([])).toBe('');
});
});