Skip to content

Commit

Permalink
fix: audit context includes interval info (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekremney authored Aug 28, 2024
1 parent 7b4a7d6 commit c0add98
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/cwv/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export async function CWVRunner(auditUrl, context, site) {
const cwvData = await rumAPIClient.query('cwv', options);
const auditResult = {
cwv: cwvData.filter((data) => data.pageviews >= DAILY_THRESHOLD * INTERVAL),
auditContext: {
interval: INTERVAL,
},
};

return {
Expand Down
3 changes: 3 additions & 0 deletions test/audits/cwv.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ describe('Index Tests', () => {
expect(result).to.deep.equal({
auditResult: {
cwv: rumData.filter((data) => data.pageviews >= 7000),
auditContext: {
interval: 7,
},
},
fullAuditRef: auditUrl,
});
Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/rum-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const rumData = [
inpCount: 3,
ttfb: 520.4500000476837,
ttfbCount: 18,
pageviews: 2620,
pageviews: 9620,
},
{
url: 'https://www.aem.live/developer/block-collection',
Expand All @@ -33,7 +33,7 @@ export const rumData = [
inpCount: 2,
ttfb: 122.90000003576279,
ttfbCount: 4,
pageviews: 2000,
pageviews: 8000,
},
{
url: 'https://www.aem.live/docs/',
Expand All @@ -45,7 +45,7 @@ export const rumData = [
inpCount: 8,
ttfb: 96.97500000149012,
ttfbCount: 16,
pageviews: 1910,
pageviews: 7910,
},
{
url: 'https://www.aem.live/tools/rum/explorer.html',
Expand All @@ -57,7 +57,7 @@ export const rumData = [
inpCount: 5,
ttfb: 312.69999980926514,
ttfbCount: 9,
pageviews: 1600,
pageviews: 7600,
},
{
url: 'https://www.aem.live/developer/tutorial',
Expand Down

0 comments on commit c0add98

Please sign in to comment.