Skip to content

feat(topics): Add new 'Home' topic as an option in the tool #1212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
16 changes: 16 additions & 0 deletions src/api/generatedTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1889,6 +1889,19 @@ export type RescheduleScheduledCorpusItemInput = {
source: ScheduledItemSource;
};

/** Contains information about the human curator who reviewed the schedule for a given date and scheduled surface. */
export type ScheduleReview = {
__typename?: 'ScheduleReview';
/** A Unix timestamp of when the scheduled was last reviewed. */
reviewedAt: Scalars['Date'];
/** A single sign-on user identifier of the user who reviewed the schedule. */
reviewedBy: Scalars['String'];
/** The date of the schedule that was reviewed, in YYYY-MM-DD format. */
scheduledDate: Scalars['Date'];
/** The GUID of the scheduledSurface that was reviewed. */
scheduledSurfaceGuid: Scalars['ID'];
};

/**
* A scheduled entry for an Approved Item to appear on a Scheduled Surface.
* For example, a story that is scheduled to appear on December 31st, 2021 on the New Tab in Firefox for the US audience.
Expand Down Expand Up @@ -1935,6 +1948,8 @@ export type ScheduledCorpusItemsResult = {
collectionCount: Scalars['Int'];
/** An array of items for a given Scheduled Surface */
items: Array<ScheduledCorpusItem>;
/** The human review status of the schedule for the given scheduledSurfaceGuid & scheduledDate. */
scheduleReview?: Maybe<ScheduleReview>;
/** The date items are scheduled for, in YYYY-MM-DD format. */
scheduledDate: Scalars['Date'];
/** The number of syndicated articles for the scheduled date. */
Expand Down Expand Up @@ -2104,6 +2119,7 @@ export enum Topics {
Food = 'FOOD',
Gaming = 'GAMING',
HealthFitness = 'HEALTH_FITNESS',
Home = 'HOME',
Parenting = 'PARENTING',
PersonalFinance = 'PERSONAL_FINANCE',
Politics = 'POLITICS',
Expand Down
3 changes: 2 additions & 1 deletion src/curated-corpus/helpers/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface DropdownOption {
code: string;
name: string;
}
// This is a list of topics. The 15 "standard" topics + coronavirus.
// This is a list of topics. The 16 "standard" topics + coronavirus.
export const topics: DropdownOption[] = [
{ code: Topics.Business, name: 'Business' },
{ code: Topics.Career, name: 'Career' },
Expand All @@ -23,6 +23,7 @@ export const topics: DropdownOption[] = [
{ code: Topics.Food, name: 'Food' },
{ code: Topics.Gaming, name: 'Gaming' },
{ code: Topics.HealthFitness, name: 'Health & Fitness' },
{ code: Topics.Home, name: 'Home' },
{ code: Topics.Parenting, name: 'Parenting' },
{ code: Topics.PersonalFinance, name: 'Personal Finance' },
{ code: Topics.Politics, name: 'Politics' },
Expand Down
6 changes: 3 additions & 3 deletions src/curated-corpus/helpers/topics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('helper functions related to topics', () => {
expect(topics).to.be.an('array');
// However, we're getting the entire list of topics here,
// not just the ones stories belong to
expect(topics).to.have.lengthOf(16);
expect(topics).to.have.lengthOf(17);

// And we expect to see the story topics, with the correct counts
expect(topics).to.contain.deep.members([
Expand Down Expand Up @@ -89,12 +89,12 @@ describe('helper functions related to topics', () => {

it('returns a list of topics without "Coronavirus" if requested', () => {
const topics = getGroupedTopicData(data, true, false);
expect(topics).to.be.an('array').with.lengthOf(15);
expect(topics).to.be.an('array').with.lengthOf(16);
});

it('returns a full list of topics if requested', () => {
const topics = getGroupedTopicData(data);
expect(topics).to.be.an('array').with.lengthOf(16);
expect(topics).to.be.an('array').with.lengthOf(17);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With most of the test updates involving updating the number of topics expected, should tests be modified to not check for the total number of topics? Should we compare them to the enums in the generated code instead?

Or is adding a topic going to be a rare enough event that it's fine to leave this - and by extension the process of adding a topic - as-is?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question and i'm not sure we know the answer yet re: how often will we get new topics. but - i think your point about avoiding testing a specific number of topics is sound. we should stop testing the number - i think testing against the enum sounds good.

});
});
});