Skip to content

Commit

Permalink
tests(smoke): assert errorCode in expectations (#6851)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored and brendankenny committed Dec 21, 2018
1 parent 1c78994 commit e52ee0c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lighthouse-cli/test/smokehouse/smokehouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ function findDifference(path, actual, expected) {

/**
* Collate results into comparisons of actual and expected scores on each audit.
* @param {{finalUrl: string, audits: !Array}} actual
* @param {{finalUrl: string, audits: !Array}} expected
* @param {{finalUrl: string, audits: !Array, errorCode: string}} actual
* @param {{finalUrl: string, audits: !Array, errorCode: string}} expected
* @return {{finalUrl: !Object, audits: !Array<!Object>}}
*/
function collateResults(actual, expected) {
Expand Down Expand Up @@ -231,6 +231,12 @@ function collateResults(actual, expected) {
equal: actual.finalUrl === expected.finalUrl,
},
audits: collatedAudits,
errorCode: {
category: 'error code',
actual: actual.errorCode,
expected: expected.errorCode,
equal: actual.errorCode === expected.errorCode,
},
};
}

Expand Down Expand Up @@ -274,11 +280,12 @@ function reportAssertion(assertion) {
/**
* Log all the comparisons between actual and expected test results, then print
* summary. Returns count of passed and failed tests.
* @param {{finalUrl: !Object, audits: !Array<!Object>}} results
* @param {{finalUrl: !Object, audits: !Array<!Object>, errorCode: !Object}} results
* @return {{passed: number, failed: number}}
*/
function report(results) {
reportAssertion(results.finalUrl);
reportAssertion(results.errorCode);

let correctCount = 0;
let failedCount = 0;
Expand Down

0 comments on commit e52ee0c

Please sign in to comment.