From 935c79c4aa2a063df198f7e774e37fd44cd057c4 Mon Sep 17 00:00:00 2001 From: Ethan Gardner Date: Fri, 29 Nov 2024 18:38:32 -0500 Subject: [PATCH] update tests for ttfb --- test/unit/dap-performance-addon.test.ts | 3 ++- test/unit/format-event-data.test.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/unit/dap-performance-addon.test.ts b/test/unit/dap-performance-addon.test.ts index ab2a90e..3088c23 100644 --- a/test/unit/dap-performance-addon.test.ts +++ b/test/unit/dap-performance-addon.test.ts @@ -1,5 +1,5 @@ import { it, describe, expect } from 'vitest'; -import { onCLS, onFCP, onINP, onLCP } from '../../src/web-vitals.js'; +import { onCLS, onFCP, onINP, onLCP, onTTFB } from '../../src/web-vitals.js'; describe('DAP Performance Addon', () => { it('defines methods to track Core Web Vitals', () => { @@ -7,5 +7,6 @@ describe('DAP Performance Addon', () => { expect(typeof onFCP).toBe('function'); expect(typeof onINP).toBe('function'); expect(typeof onLCP).toBe('function'); + expect(typeof onTTFB).toBe('function'); }); }); diff --git a/test/unit/format-event-data.test.ts b/test/unit/format-event-data.test.ts index be282df..6543f00 100644 --- a/test/unit/format-event-data.test.ts +++ b/test/unit/format-event-data.test.ts @@ -5,6 +5,7 @@ import type { FCPAttribution, INPAttribution, LCPAttribution, + TTFBAttribution, } from 'web-vitals'; describe('formatEventData', () => { @@ -98,9 +99,8 @@ describe('formatEventData', () => { dnsDuration: 0, connectionDuration: 2015, requestDuration: 47, - }; + } as TTFBAttribution; - // @ts-ignore const result = formatEventData('TTFB', attribution); expect(result).toEqual({