Skip to content

Commit 1d3c5f0

Browse files
committed
placeholder tests
1 parent 5b14473 commit 1d3c5f0

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed

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

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,121 @@ describe('Unit | util | createPerformanceEntries', () => {
147147
});
148148
});
149149
});
150+
151+
describe('getCumulativeLayoutShift', () => {
152+
it('works with an CLS metric', async () => {
153+
const metric = {
154+
value: 5108.299,
155+
entries: [],
156+
};
157+
158+
const event = getCumulativeLayoutShift(metric);
159+
160+
expect(event).toEqual({
161+
type: 'web-vital',
162+
name: 'cumulative-layout-shift',
163+
start: 1672531205.108299,
164+
end: 1672531205.108299,
165+
data: { value: 5108.299, size: 5108.299, nodeId: undefined },
166+
});
167+
});
168+
});
169+
170+
describe('getFirstInputDelay', () => {
171+
it('works with an FID metric', async () => {
172+
const metric = {
173+
value: 5108.299,
174+
entries: [],
175+
};
176+
177+
const event = getFirstInputDelay(metric);
178+
179+
expect(event).toEqual({
180+
type: 'web-vital',
181+
name: 'first-input-delay',
182+
start: 1672531205.108299,
183+
end: 1672531205.108299,
184+
data: { value: 5108.299, size: 5108.299, nodeId: undefined },
185+
});
186+
});
187+
});
188+
189+
describe('getInteractionToNextPaint', () => {
190+
it('works with an INP metric', async () => {
191+
const metric = {
192+
value: 5108.299,
193+
entries: [],
194+
};
195+
196+
const event = getInteractionToNextPaint(metric);
197+
198+
expect(event).toEqual({
199+
type: 'web-vital',
200+
name: 'interaction-to-next-paint',
201+
start: 1672531205.108299,
202+
end: 1672531205.108299,
203+
data: { value: 5108.299, rating: 'good', size: 5108.299, nodeId: undefined },
204+
});
205+
});
206+
});
207+
208+
describe('getCumulativeLayoutShift', () => {
209+
it('works with an CLS metric', async () => {
210+
const metric = {
211+
value: 5108.299,
212+
rating: 'good' as const,
213+
entries: [],
214+
};
215+
216+
const event = getCumulativeLayoutShift(metric);
217+
218+
expect(event).toEqual({
219+
type: 'web-vital',
220+
name: 'cumulative-layout-shift',
221+
start: 1672531205.108299,
222+
end: 1672531205.108299,
223+
data: { value: 5108.299, size: 5108.299, rating: 'good', nodeId: undefined },
224+
});
225+
});
226+
});
227+
228+
describe('getFirstInputDelay', () => {
229+
it('works with an FID metric', async () => {
230+
const metric = {
231+
value: 5108.299,
232+
rating: 'good' as const,
233+
entries: [],
234+
};
235+
236+
const event = getFirstInputDelay(metric);
237+
238+
expect(event).toEqual({
239+
type: 'web-vital',
240+
name: 'first-input-delay',
241+
start: 1672531205.108299,
242+
end: 1672531205.108299,
243+
data: { value: 5108.299, size: 5108.299, rating: 'good', nodeId: undefined },
244+
});
245+
});
246+
});
247+
248+
describe('getInteractionToNextPaint', () => {
249+
it('works with an INP metric', async () => {
250+
const metric = {
251+
value: 5108.299,
252+
rating: 'good' as const,
253+
entries: [],
254+
};
255+
256+
const event = getInteractionToNextPaint(metric);
257+
258+
expect(event).toEqual({
259+
type: 'web-vital',
260+
name: 'interaction-to-next-paint',
261+
start: 1672531205.108299,
262+
end: 1672531205.108299,
263+
data: { value: 5108.299, size: 5108.299, rating: 'good', nodeId: undefined },
264+
});
265+
});
266+
});
150267
});

0 commit comments

Comments
 (0)