Skip to content

Commit 270766d

Browse files
authored
Merge pull request #70 from Pocket/MC-730
chore: [MC-730] Remove references to timeToRead
2 parents 2cd9d6f + 8ac570c commit 270766d

File tree

8 files changed

+133
-25
lines changed

8 files changed

+133
-25
lines changed

src/api/desktop/recent-saves/response.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const reduceGraphItem = (savedItem: GraphSavedItem): Save => {
3535
excerpt: nestedItem.excerpt,
3636
domain: nestedItem.domain,
3737
wordCount: nestedItem.wordCount,
38-
timeToRead: nestedItem.timeToRead,
3938
topImageUrl: nestedItem?.topImage?.url ?? null,
4039
};
4140
};

src/api/desktop/recommendations/recommendations.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,5 @@ describe('recommendations API server', () => {
8585
expect(recommendation.tileId).toEqual(
8686
mockResponse.newTabSlate.recommendations[0].tileId
8787
);
88-
if (recommendation.timeToRead !== undefined) {
89-
expect(recommendation.timeToRead).toBeGreaterThanOrEqual(1);
90-
}
9188
});
9289
});

src/api/desktop/recommendations/response.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ describe('response', () => {
4343
`utm_source=${graphResponse.newTabSlate.utmSource}`
4444
)
4545
).toBeTruthy();
46-
expect(res.data[0].timeToRead).toBeUndefined();
47-
expect(res.data[1].timeToRead).toBeUndefined();
4846
} else {
4947
throw validate.errors;
5048
}

src/generated/graphql/types.ts

Lines changed: 127 additions & 6 deletions
Large diffs are not rendered by default.

src/graphql-proxy/recent-saves/RecentSaves.graphql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ query RecentSaves($pagination: PaginationInput) {
2020
url
2121
}
2222
title
23-
timeToRead
2423
resolvedUrl
2524
givenUrl
2625
excerpt
@@ -31,4 +30,4 @@ query RecentSaves($pagination: PaginationInput) {
3130
}
3231
}
3332
}
34-
}
33+
}

src/graphql-proxy/recent-saves/__mocks__/recent-saves.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ const fakeSaves = (count): RecentSavesQuery['user']['savedItems']['edges'] => {
3131
url: common.itemImage(),
3232
},
3333
title: common.itemTitle(),
34-
timeToRead: faker.datatype.number({ max: 15 }),
3534
resolvedUrl: common.itemUrl(),
3635
givenUrl: common.itemUrl(),
3736
excerpt: common.itemExcerpt(),

src/graphql-proxy/recommendations/Recommendations.graphql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ query NewTabRecommendations($locale: String!, $region: String, $count: Int) {
1010
publisher
1111
title
1212
url
13-
# timeToRead
1413
}
1514
}
1615
}

src/graphql-proxy/recommendations/__mocks__/recommendations.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,9 @@ const fakerLocales = {
2828
it: 'it',
2929
};
3030

31-
/**
32-
*
33-
* @param hasTimeToRead If true, timeToRead is set to [1, 9], otherwise it's undefined.
34-
*/
35-
const fakeRecommendation = (hasTimeToRead = true): GraphRecommendation => {
36-
const recommendationWithoutTimeToRead: GraphRecommendation = {
31+
32+
const fakeRecommendation = (): GraphRecommendation => {
33+
const recommendation: GraphRecommendation = {
3734
__typename: 'CorpusRecommendation',
3835
id: faker.datatype.uuid(),
3936
tileId: faker.datatype.number(),
@@ -46,7 +43,7 @@ const fakeRecommendation = (hasTimeToRead = true): GraphRecommendation => {
4643
},
4744
};
4845

49-
return recommendationWithoutTimeToRead;
46+
return recommendation;
5047
};
5148

5249
const fakeRecommendations = (
@@ -55,8 +52,7 @@ const fakeRecommendations = (
5552
return Array(count)
5653
.fill(0)
5754
.map((value, index) =>
58-
// Add timeToRead only for even numbered recommendations.
59-
fakeRecommendation(index % 2 === 0)
55+
fakeRecommendation()
6056
);
6157
};
6258

0 commit comments

Comments
 (0)