Files
Renderive/webapp_gallery/tests/runtime/client_performance.test.ts
2026-08-15 21:48:23 +08:00

3 lines
798 B
TypeScript

import {describe,expect,it} from "vitest";import {Client_Performance} from "../../src/runtime/client_performance";
describe("client performance",()=>{it("tracks change, duplicate and overwrite independently",()=>{const performance=new Client_Performance();performance.record_animation_frame(10);performance.record_animation_frame(26);performance.record_pixel(30,1n,false);performance.record_pixel(40,1n,true);performance.record_pixel(50,2n,false);performance.record_presentation(55);performance.record_round_trip(60,12);const value=performance.snapshot(70,9);expect(value.changed_pixel_frames).toBe(2);expect(value.duplicate_pixel_frames).toBe(1);expect(value.overwritten_pixel_frames).toBe(1);expect(value.display_interval_latest_ms).toBe(16);expect(value.websocket_buffered_bytes).toBe(9);});});