Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/api/desktop/recent-saves/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const reduceGraphItem = (savedItem: GraphSavedItem): Save => {
excerpt: nestedItem.excerpt,
domain: nestedItem.domain,
wordCount: nestedItem.wordCount,
timeToRead: nestedItem.timeToRead,
topImageUrl: nestedItem?.topImage?.url ?? null,
};
};
Expand Down
3 changes: 0 additions & 3 deletions src/api/desktop/recommendations/recommendations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,5 @@ describe('recommendations API server', () => {
expect(recommendation.tileId).toEqual(
mockResponse.newTabSlate.recommendations[0].tileId
);
if (recommendation.timeToRead !== undefined) {
expect(recommendation.timeToRead).toBeGreaterThanOrEqual(1);
}
});
});
2 changes: 0 additions & 2 deletions src/api/desktop/recommendations/response.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ describe('response', () => {
`utm_source=${graphResponse.newTabSlate.utmSource}`
)
).toBeTruthy();
expect(res.data[0].timeToRead).toBeUndefined();
expect(res.data[1].timeToRead).toBeUndefined();
} else {
throw validate.errors;
}
Expand Down
133 changes: 127 additions & 6 deletions src/generated/graphql/types.ts

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions src/graphql-proxy/recent-saves/RecentSaves.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ query RecentSaves($pagination: PaginationInput) {
url
}
title
timeToRead
resolvedUrl
givenUrl
excerpt
Expand All @@ -31,4 +30,4 @@ query RecentSaves($pagination: PaginationInput) {
}
}
}
}
}
1 change: 0 additions & 1 deletion src/graphql-proxy/recent-saves/__mocks__/recent-saves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const fakeSaves = (count): RecentSavesQuery['user']['savedItems']['edges'] => {
url: common.itemImage(),
},
title: common.itemTitle(),
timeToRead: faker.datatype.number({ max: 15 }),
resolvedUrl: common.itemUrl(),
givenUrl: common.itemUrl(),
excerpt: common.itemExcerpt(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ query NewTabRecommendations($locale: String!, $region: String, $count: Int) {
publisher
title
url
# timeToRead
}
}
}
Expand Down
14 changes: 5 additions & 9 deletions src/graphql-proxy/recommendations/__mocks__/recommendations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ const fakerLocales = {
it: 'it',
};

/**
*
* @param hasTimeToRead If true, timeToRead is set to [1, 9], otherwise it's undefined.
*/
const fakeRecommendation = (hasTimeToRead = true): GraphRecommendation => {
const recommendationWithoutTimeToRead: GraphRecommendation = {

const fakeRecommendation = (): GraphRecommendation => {
const recommendation: GraphRecommendation = {
__typename: 'CorpusRecommendation',
id: faker.datatype.uuid(),
tileId: faker.datatype.number(),
Expand All @@ -46,7 +43,7 @@ const fakeRecommendation = (hasTimeToRead = true): GraphRecommendation => {
},
};

return recommendationWithoutTimeToRead;
return recommendation;
};

const fakeRecommendations = (
Expand All @@ -55,8 +52,7 @@ const fakeRecommendations = (
return Array(count)
.fill(0)
.map((value, index) =>
// Add timeToRead only for even numbered recommendations.
fakeRecommendation(index % 2 === 0)
fakeRecommendation()
);
};

Expand Down