Add names to Groups

Signed-off-by: kielosz <kielosz@gmail.com>
This commit is contained in:
kielosz
2022-08-02 12:43:48 +02:00
parent 62bee85ae5
commit 62aae9363a
4 changed files with 6 additions and 3 deletions
@@ -19,4 +19,5 @@
*/
export type Group = {
id: string;
name?: string;
};
@@ -32,6 +32,7 @@ const mockGroups: Group[] = [
},
{
id: 'test-group-3',
name: 'Test Group 3',
},
];
@@ -76,7 +77,7 @@ describe('<CostInsightsTabs />', () => {
);
await userEvent.click(rendered.getByTestId('cost-insights-groups-tab'));
mockGroups.forEach(group =>
expect(rendered.getByText(group.id)).toBeInTheDocument(),
expect(rendered.getByText(group.name ?? group.id)).toBeInTheDocument(),
);
});
});
@@ -100,7 +100,7 @@ export const CostInsightsTabs = ({ groups }: CostInsightsTabsProps) => {
data-testid={g.id}
onClick={updateGroupFilterAndCloseMenu(g)}
>
{g.id}
{g.name ?? g.id}
</MenuItem>
))}
</Menu>
+2 -1
View File
@@ -52,7 +52,8 @@ export class ExampleCostInsightsClient implements CostInsightsApi {
async getUserGroups(userId: string): Promise<Group[]> {
const groups: Group[] = await this.request({ userId }, [
{ id: 'pied-piper' },
{ id: 'group-a', name: 'Group A' },
{ id: 'group-b', name: 'Group B' },
]);
return groups;