Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
c298lee committed Jul 22, 2024
1 parent a83dcfd commit 77a12ac
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
expectedFIDPerformanceSpan,
expectedFPPerformanceSpan,
expectedLCPPerformanceSpan,
expectedTTFBPerformanceSpan,
expectedMemoryPerformanceSpan,
expectedNavigationPerformanceSpan,
getExpectedReplayEvent,
Expand Down Expand Up @@ -65,6 +66,7 @@ sentryTest(
expectedNavigationPerformanceSpan,
expectedLCPPerformanceSpan,
expectedCLSPerformanceSpan,
expectedTTFBPerformanceSpan,
expectedFIDPerformanceSpan,
expectedFPPerformanceSpan,
expectedFCPPerformanceSpan,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
expectedFIDPerformanceSpan,
expectedFPPerformanceSpan,
expectedLCPPerformanceSpan,
expectedTTFBPerformanceSpan,
expectedMemoryPerformanceSpan,
expectedNavigationBreadcrumb,
expectedNavigationPerformanceSpan,
Expand Down Expand Up @@ -86,6 +87,7 @@ sentryTest(
expectedNavigationPerformanceSpan,
expectedLCPPerformanceSpan,
expectedCLSPerformanceSpan,
expectedTTFBPerformanceSpan,
expectedFIDPerformanceSpan,
expectedFPPerformanceSpan,
expectedFCPPerformanceSpan,
Expand Down Expand Up @@ -126,6 +128,7 @@ sentryTest(
expectedReloadPerformanceSpan,
expectedLCPPerformanceSpan,
expectedCLSPerformanceSpan,
expectedTTFBPerformanceSpan,
expectedFIDPerformanceSpan,
expectedFPPerformanceSpan,
expectedFCPPerformanceSpan,
Expand Down Expand Up @@ -195,6 +198,7 @@ sentryTest(
expectedNavigationPerformanceSpan,
expectedLCPPerformanceSpan,
expectedCLSPerformanceSpan,
expectedTTFBPerformanceSpan,
expectedFIDPerformanceSpan,
expectedFPPerformanceSpan,
expectedFCPPerformanceSpan,
Expand Down Expand Up @@ -318,6 +322,7 @@ sentryTest(
expectedNavigationPerformanceSpan,
expectedLCPPerformanceSpan,
expectedCLSPerformanceSpan,
expectedTTFBPerformanceSpan,
expectedFIDPerformanceSpan,
expectedFPPerformanceSpan,
expectedFCPPerformanceSpan,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export const expectedLCPPerformanceSpan = {
endTimestamp: expect.any(Number),
data: {
value: expect.any(Number),
nodeId: expect.any(Number),
nodeId: expect.any(Array),
rating: expect.any(String),
size: expect.any(Number),
},
Expand All @@ -142,6 +142,7 @@ export const expectedCLSPerformanceSpan = {
value: expect.any(Number),
rating: expect.any(String),
size: expect.any(Number),
nodeId: expect.any(Array),
},
};

Expand All @@ -154,7 +155,7 @@ export const expectedFIDPerformanceSpan = {
value: expect.any(Number),
rating: expect.any(String),
size: expect.any(Number),
nodeId: expect.any(Number),
nodeId: expect.any(Array),
},
};

Expand All @@ -167,11 +168,11 @@ export const expectedINPPerformanceSpan = {
value: expect.any(Number),
rating: expect.any(String),
size: expect.any(Number),
nodeId: expect.any(Number),
nodeId: expect.any(Array),
},
};

export const expectedTTFB = {
export const expectedTTFBPerformanceSpan = {
op: 'web-vital',
description: 'time-to-first-byte',
startTimestamp: expect.any(Number),
Expand All @@ -180,7 +181,7 @@ export const expectedTTFB = {
value: expect.any(Number),
rating: expect.any(String),
size: expect.any(Number),
nodeId: expect.any(Number),
nodeId: expect.any(Array),
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,26 @@ export const ReplayRecordingData = [
value: expect.any(Number),
size: expect.any(Number),
rating: expect.any(String),
nodeId: 16,
nodeId: [16],
},
},
},
},
{
type: 5,
timestamp: expect.any(Number),
data: {
tag: 'performanceSpan',
payload: {
op: 'web-vital',
description: 'time-to-first-byte',
startTimestamp: expect.any(Number),
endTimestamp: expect.any(Number),
data: {
value: expect.any(Number),
size: expect.any(Number),
rating: expect.any(String),
nodeId: [],
},
},
},
Expand All @@ -239,6 +258,7 @@ export const ReplayRecordingData = [
value: expect.any(Number),
size: expect.any(Number),
rating: expect.any(String),
nodeId: [],
},
},
},
Expand All @@ -257,7 +277,7 @@ export const ReplayRecordingData = [
value: expect.any(Number),
size: expect.any(Number),
rating: expect.any(String),
nodeId: 10,
nodeId: [10],
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('Unit | util | createPerformanceEntries', () => {
name: 'largest-contentful-paint',
start: 1672531205.108299,
end: 1672531205.108299,
data: { value: 5108.299, rating: 'good', size: 5108.299, nodeId: undefined },
data: { value: 5108.299, rating: 'good', size: 5108.299, nodeId: [] },
});
});
});
Expand All @@ -104,7 +104,7 @@ describe('Unit | util | createPerformanceEntries', () => {
name: 'cumulative-layout-shift',
start: 1672531205.108299,
end: 1672531205.108299,
data: { value: 5108.299, size: 5108.299, rating: 'good', nodeId: undefined },
data: { value: 5108.299, size: 5108.299, rating: 'good', nodeId: [] },
});
});
});
Expand All @@ -124,7 +124,7 @@ describe('Unit | util | createPerformanceEntries', () => {
name: 'first-input-delay',
start: 1672531205.108299,
end: 1672531205.108299,
data: { value: 5108.299, size: 5108.299, rating: 'good', nodeId: undefined },
data: { value: 5108.299, size: 5108.299, rating: 'good', nodeId: [] },
});
});
});
Expand All @@ -144,7 +144,7 @@ describe('Unit | util | createPerformanceEntries', () => {
name: 'interaction-to-next-paint',
start: 1672531205.108299,
end: 1672531205.108299,
data: { value: 5108.299, size: 5108.299, rating: 'good', nodeId: undefined },
data: { value: 5108.299, size: 5108.299, rating: 'good', nodeId: [] },
});
});
});
Expand All @@ -164,7 +164,7 @@ describe('Unit | util | createPerformanceEntries', () => {
name: 'time-to-first-byte',
start: 1672531205.108299,
end: 1672531205.108299,
data: { value: 5108.299, size: 5108.299, rating: 'good', nodeId: undefined },
data: { value: 5108.299, size: 5108.299, rating: 'good', nodeId: [] },
});
});
});
Expand Down

0 comments on commit 77a12ac

Please sign in to comment.