Skip to content

Commit 6e29bcc

Browse files
committed
placeholder tests
1 parent 59a985f commit 6e29bcc

File tree

4 files changed

+62
-5
lines changed

4 files changed

+62
-5
lines changed

dev-packages/browser-integration-tests/utils/replayEventTemplates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export const expectedMemoryPerformanceSpan = {
121121
};
122122

123123
export const expectedLCPPerformanceSpan = {
124-
op: 'largest-contentful-paint',
124+
op: 'web-vital',
125125
description: 'largest-contentful-paint',
126126
startTimestamp: expect.any(Number),
127127
endTimestamp: expect.any(Number),

dev-packages/e2e-tests/test-applications/react-send-to-sentry/tests/fixtures/ReplayRecordingData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export const ReplayRecordingData = [
211211
data: {
212212
tag: 'performanceSpan',
213213
payload: {
214-
op: 'largest-contentful-paint',
214+
op: 'web-vital',
215215
description: 'largest-contentful-paint',
216216
startTimestamp: expect.any(Number),
217217
endTimestamp: expect.any(Number),

dev-packages/e2e-tests/test-applications/standard-frontend-react/tests/fixtures/ReplayRecordingData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export const ReplayRecordingData = [
211211
data: {
212212
tag: 'performanceSpan',
213213
payload: {
214-
op: 'largest-contentful-paint',
214+
op: 'web-vital',
215215
description: 'largest-contentful-paint',
216216
startTimestamp: expect.any(Number),
217217
endTimestamp: expect.any(Number),

packages/replay-internal/test/unit/util/createPerformanceEntry.test.ts

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ vi.mock('@sentry/utils', async () => ({
1111
}));
1212

1313
import { WINDOW } from '../../../src/constants';
14-
import { createPerformanceEntries, getLargestContentfulPaint } from '../../../src/util/createPerformanceEntries';
14+
import { createPerformanceEntries, getLargestContentfulPaint, getCumulativeLayoutShift, getFirstInputDelay, getInteractionToNextPaint } from '../../../src/util/createPerformanceEntries';
1515
import { PerformanceEntryNavigation } from '../../fixtures/performanceEntry/navigation';
1616

1717
describe('Unit | util | createPerformanceEntries', () => {
@@ -72,12 +72,69 @@ describe('Unit | util | createPerformanceEntries', () => {
7272
const event = getLargestContentfulPaint(metric);
7373

7474
expect(event).toEqual({
75-
type: 'largest-contentful-paint',
75+
type: 'web-vital',
7676
name: 'largest-contentful-paint',
7777
start: 1672531205.108299,
7878
end: 1672531205.108299,
7979
data: { value: 5108.299, size: 5108.299, nodeId: undefined },
8080
});
8181
});
8282
});
83+
84+
describe('getCumulativeLayoutShift', () => {
85+
it('works with an CLS metric', async () => {
86+
const metric = {
87+
value: 5108.299,
88+
entries: [],
89+
};
90+
91+
const event = getCumulativeLayoutShift(metric);
92+
93+
expect(event).toEqual({
94+
type: 'web-vital',
95+
name: 'cumulative-layout-shift',
96+
start: 1672531205.108299,
97+
end: 1672531205.108299,
98+
data: { value: 5108.299, size: 5108.299, nodeId: undefined },
99+
});
100+
});
101+
});
102+
103+
describe('getFirstInputDelay', () => {
104+
it('works with an FID metric', async () => {
105+
const metric = {
106+
value: 5108.299,
107+
entries: [],
108+
};
109+
110+
const event = getFirstInputDelay(metric);
111+
112+
expect(event).toEqual({
113+
type: 'web-vital',
114+
name: 'first-input-delay',
115+
start: 1672531205.108299,
116+
end: 1672531205.108299,
117+
data: { value: 5108.299, size: 5108.299, nodeId: undefined },
118+
});
119+
});
120+
});
121+
122+
describe('getInteractionToNextPaint', () => {
123+
it('works with an INP metric', async () => {
124+
const metric = {
125+
value: 5108.299,
126+
entries: [],
127+
};
128+
129+
const event = getInteractionToNextPaint(metric);
130+
131+
expect(event).toEqual({
132+
type: 'web-vital',
133+
name: 'interaction-to-next-paint',
134+
start: 1672531205.108299,
135+
end: 1672531205.108299,
136+
data: { value: 5108.299, size: 5108.299, nodeId: undefined },
137+
});
138+
});
139+
});
83140
});

0 commit comments

Comments
 (0)