Skip to content

Commit

Permalink
feat(datahealthapi): adding missing query parameters to some endpoints (
Browse files Browse the repository at this point in the history
  • Loading branch information
jmprovencher authored Oct 12, 2023
1 parent 312a390 commit 108f500
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ export interface DataHealthGetOverviewParams extends OrganizationParamParts, Tim
* The category to filter by when getting the overview.
*/
category?: string;
/**
* The tracking id to filter by when getting groups listing.
*/
trackingId?: string[];
/**
* Whether to include beta rules when getting details.
*/
showBetaRules?: boolean;
}

export interface DataHealthGetOverviewResponse {
Expand Down Expand Up @@ -197,6 +205,10 @@ export interface DataHealthGetGroupListingParams extends OrganizationParamParts,
* Whether to show groups with no validated entity or not.
*/
showEmptyGroups?: boolean;
/**
* Whether to show groups with only beta rules.
*/
showBetaRules?: boolean;
}

export interface DataHealthGetGroupListingResponse extends PaginatedResponse {
Expand Down Expand Up @@ -234,6 +246,14 @@ export interface DataHealthGetGroupDetailParams extends OrganizationParamParts,
* The category to filter by when getting details on a group.
*/
category: string;
/**
* The tracking id to filter by when getting groups listing.
*/
trackingId?: string[];
/**
* Whether to include beta rules when getting details.
*/
showBetaRules?: boolean;
/**
* The group to filter by when getting details.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ describe('DataHealth', () => {
it('should make a GET call to the data health get overview url', () => {
const dataHealthGetOverviewParams: DataHealthGetOverviewParams = {
...baseParams,
category: 'unicorns',
trackingId: ['PetShop'],
};
dataHealth.getOverview(dataHealthGetOverviewParams);
expect(api.get).toHaveBeenCalledTimes(1);
expect(api.get).toHaveBeenCalledWith(
`${DataHealth.baseUrl}/overview?org=someOrgId&from=1986-04-26T01%3A23%3A58.000Z&to=1986-04-27T02%3A32%3A15.000Z`,
`${DataHealth.baseUrl}/overview?org=someOrgId&from=1986-04-26T01%3A23%3A58.000Z&to=1986-04-27T02%3A32%3A15.000Z&category=unicorns&trackingId=PetShop`,
);
});
});
Expand All @@ -85,11 +87,12 @@ describe('DataHealth', () => {
const dataHealthGetGroupListingParams: DataHealthGetGroupListingParams = {
...baseParams,
category: 'unicorns',
trackingId: ['PetShop'],
};
dataHealth.getGroupListing(dataHealthGetGroupListingParams);
expect(api.get).toHaveBeenCalledTimes(1);
expect(api.get).toHaveBeenCalledWith(
`${DataHealth.baseUrl}/groups?org=someOrgId&from=1986-04-26T01%3A23%3A58.000Z&to=1986-04-27T02%3A32%3A15.000Z&category=unicorns`,
`${DataHealth.baseUrl}/groups?org=someOrgId&from=1986-04-26T01%3A23%3A58.000Z&to=1986-04-27T02%3A32%3A15.000Z&category=unicorns&trackingId=PetShop`,
);
});
});
Expand All @@ -100,11 +103,12 @@ describe('DataHealth', () => {
...baseParams,
category: 'unicorns',
group: 'horned',
trackingId: ['PetShop'],
};
dataHealth.getGroupDetail(dataHealthGetGroupDetailParams);
expect(api.get).toHaveBeenCalledTimes(1);
expect(api.get).toHaveBeenCalledWith(
`${DataHealth.baseUrl}/groups/detail?org=someOrgId&from=1986-04-26T01%3A23%3A58.000Z&to=1986-04-27T02%3A32%3A15.000Z&category=unicorns&group=horned`,
`${DataHealth.baseUrl}/groups/detail?org=someOrgId&from=1986-04-26T01%3A23%3A58.000Z&to=1986-04-27T02%3A32%3A15.000Z&category=unicorns&group=horned&trackingId=PetShop`,
);
});
});
Expand Down

0 comments on commit 108f500

Please sign in to comment.