tests(smoke): assert errorCode in expectations (#6851)

This commit is contained in:
Connor Clark 2018-12-20 16:40:50 -08:00 коммит произвёл Brendan Kenny
Родитель 1c789946b9
Коммит e52ee0c126
1 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -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) {
@ -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,
},
};
}
@ -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;