Skip to content

Commit

Permalink
rn
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraine committed Jul 12, 2023
1 parent 508ccef commit fc618d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/gather/gatherers/dobetterweb/response-compression.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class ResponseCompression extends FRGatherer {
* @param {LH.Artifacts.NetworkRequest[]} networkRecords
* @return {Promise<LH.Artifacts['ResponseCompression']>}
*/
async _getArtifact(context, networkRecords) {
async getCompressibleRecords(context, networkRecords) {
const session = context.driver.defaultSession;
const textRecords = ResponseCompression.filterUnoptimizedResponses(networkRecords);

Expand Down Expand Up @@ -138,7 +138,7 @@ class ResponseCompression extends FRGatherer {
async getArtifact(context) {
const devtoolsLog = context.dependencies.DevtoolsLog;
const networkRecords = await NetworkRecords.request(devtoolsLog, context);
return this._getArtifact(context, networkRecords);
return this.getCompressibleRecords(context, networkRecords);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,22 @@ describe('Optimized responses', () => {
});

it('returns only text and non encoded responses', async () => {
const artifact = await gatherer._getArtifact(context, networkRecords);
const artifact = await gatherer.getCompressibleRecords(context, networkRecords);
expect(artifact).toHaveLength(2);
expect(artifact[0].url).toMatch(/index\.css$/);
expect(artifact[1].url).toMatch(/index\.json$/);
});

it('computes sizes', async () => {
const artifact = await gatherer._getArtifact(context, networkRecords);
const artifact = await gatherer.getCompressibleRecords(context, networkRecords);
expect(artifact).toHaveLength(2);
expect(artifact[0].resourceSize).toEqual(6);
expect(artifact[0].gzipSize).toEqual(26);
});

it('recovers from driver errors', async () => {
mocks.networkMock.fetchResponseBodyFromCache.mockRejectedValue(new Error('Failed'));
const artifact = await gatherer._getArtifact(context, networkRecords);
const artifact = await gatherer.getCompressibleRecords(context, networkRecords);
expect(artifact).toHaveLength(2);
expect(artifact[0].resourceSize).toEqual(6);
expect(artifact[0].gzipSize).toBeUndefined();
Expand Down Expand Up @@ -179,7 +179,7 @@ describe('Optimized responses', () => {
},
];

const artifact = await gatherer._getArtifact(context, networkRecords);
const artifact = await gatherer.getCompressibleRecords(context, networkRecords);
expect(artifact).toHaveLength(1);
expect(artifact[0].resourceSize).toEqual(123);
});
Expand Down

0 comments on commit fc618d3

Please sign in to comment.