Skip to content

Commit

Permalink
fix: initialize scores as an empty object (SITES-18417) (#87)
Browse files Browse the repository at this point in the history
Fix for SITES-18417-fix: not all audits have as result scores and adding an audit without scores is failing, hence initializing the scores to an empty object, if no scores in the result.
  • Loading branch information
iuliag authored Jan 18, 2024
1 parent def0c89 commit eb38e32
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/spacecat-shared-data-access/src/models/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ export const createAudit = (data) => {
throw new Error('Audit result must be an object');
}

if (!newState.scores) {
newState.scores = {};
}
validateScores(data.auditResult, data.auditType);

if (data.previousAuditResult && !isObject(data.previousAuditResult)) {
Expand Down

0 comments on commit eb38e32

Please sign in to comment.