Skip to content

Commit

Permalink
tests + lint fixup.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Mar 9, 2018
1 parent 12ae517 commit 1584258
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lighthouse-core/audits/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class Audit {
return {
score,
scoreDisplayMode,
informative
informative,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class TotalByteWeight extends ByteEfficiencyAudit {
'Large network payloads cost users real money and are highly correlated with ' +
'long load times. [Learn ' +
'more](https://developers.google.com/web/tools/lighthouse/audits/network-payloads).',
scoreDisplayMode: ByteEfficiencyAudit.SCORING_MODES.NUMERIC,
requiredArtifacts: ['devtoolsLogs'],
};
}
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/critical-request-chains.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class CriticalRequestChains extends Audit {

return {
rawValue: chainCount === 0,
displayValue: `${Util.formatNumber(chainCount)} chains found`,
displayValue: chainCount ? `${Util.formatNumber(chainCount)} chains found`: '',
extendedInfo: {
value: {
chains: flattenedChains,
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/scoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ReportScoring {
const categoryScore = ReportScoring.arithmeticMean(scores);
// mutate config.categories[].score
category.score = categoryScore;
};
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/test/audits/critical-request-chains-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const mockArtifacts = (mockChain) => {
describe('Performance: critical-request-chains audit', () => {
it('calculates the correct chain result for failing example', () => {
return CriticalRequestChains.audit(mockArtifacts(FAILING_REQUEST_CHAIN)).then(output => {
assert.equal(output.displayValue, 2);
assert.equal(output.displayValue, '2 chains found');
assert.equal(output.rawValue, false);
assert.ok(output.details);
});
Expand All @@ -95,21 +95,21 @@ describe('Performance: critical-request-chains audit', () => {
it('calculates the correct chain result for passing example', () => {
return CriticalRequestChains.audit(mockArtifacts(PASSING_REQUEST_CHAIN)).then(output => {
assert.equal(output.details.longestChain.duration, 1000);
assert.equal(output.displayValue, 0);
assert.equal(output.displayValue, '');
assert.equal(output.rawValue, true);
});
});

it('calculates the correct chain result for passing example (no 2.)', () => {
return CriticalRequestChains.audit(mockArtifacts(PASSING_REQUEST_CHAIN_2)).then(output => {
assert.equal(output.displayValue, 0);
assert.equal(output.displayValue, '');
assert.equal(output.rawValue, true);
});
});

it('calculates the correct chain result for empty example', () => {
return CriticalRequestChains.audit(mockArtifacts(EMPTY_REQUEST_CHAIN)).then(output => {
assert.equal(output.displayValue, 0);
assert.equal(output.displayValue, '');
assert.equal(output.rawValue, true);
});
});
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/test/runner-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ describe('Runner', () => {

return Runner.run({}, {url, config}).then(results => {
const audits = results.audits;
assert.equal(audits['critical-request-chains'].displayValue, 5);
assert.equal(audits['critical-request-chains'].displayValue, '5 chains found');
assert.equal(audits['critical-request-chains'].rawValue, false);
});
});
Expand Down

0 comments on commit 1584258

Please sign in to comment.