Skip to content

Commit

Permalink
feat: result schema change
Browse files Browse the repository at this point in the history
  • Loading branch information
ekremney committed Aug 26, 2024
1 parent 84eaab8 commit 471e51b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/cwv/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export async function CWVRunner(auditUrl, context, site) {
granularity: 'hourly',
};
const cwvData = await rumAPIClient.query('cwv', options);
const auditResult = cwvData.filter((data) => data.pageviews >= DAILY_THRESHOLD * INTERVAL);
const auditResult = {
cwv: cwvData.filter((data) => data.pageviews >= DAILY_THRESHOLD * INTERVAL),
};

return {
auditResult,
Expand Down
4 changes: 3 additions & 1 deletion test/audits/cwv.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ describe('Index Tests', () => {
it('cwv audit runs rum api client cwv query', async () => {
const result = await CWVRunner('www.spacecat.com', context, site);
expect(result).to.deep.equal({
auditResult: rumData.filter((data) => data.pageviews >= 7000),
auditResult: {
cwv: rumData.filter((data) => data.pageviews >= 7000),
},
fullAuditRef: auditUrl,
});
});
Expand Down

0 comments on commit 471e51b

Please sign in to comment.