From 61c6e8f97ef731832959cbd8e37cc4aac74a5f28 Mon Sep 17 00:00:00 2001 From: zbeyens Date: Wed, 11 Sep 2024 10:04:59 +0200 Subject: [PATCH] test --- .../core/src/react/editor/withPlate.spec.ts | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 packages/core/src/react/editor/withPlate.spec.ts diff --git a/packages/core/src/react/editor/withPlate.spec.ts b/packages/core/src/react/editor/withPlate.spec.ts deleted file mode 100644 index 915c007020..0000000000 --- a/packages/core/src/react/editor/withPlate.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { createPlateEditor } from './withPlate'; - -describe('createPlateEditor', () => { - it('performance', () => { - const warmupRuns = 500; - const testRuns = 5000; - const times: number[] = []; - - // Warm-up - for (let i = 0; i < warmupRuns; i++) { - createPlateEditor(); - } - - // Test runs - for (let i = 0; i < testRuns; i++) { - const start = performance.now(); - createPlateEditor(); - const end = performance.now(); - times.push(end - start); - } - - const average = times.reduce((a, b) => a + b) / times.length; - const median = times.sort((a, b) => a - b)[Math.floor(times.length / 2)]; - const p95 = times[Math.floor(times.length * 0.95)]; - - console.info(`Average: ${average.toFixed(3)}ms`); - console.info(`Median: ${median.toFixed(3)}ms`); - console.info(`95th percentile: ${p95.toFixed(3)}ms`); - - expect(average).toBeLessThan(0.5); // Adjust threshold as needed - expect(p95).toBeLessThan(1); // Adjust threshold as needed - }); -});