catalog-react: fix comments

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2023-10-09 14:12:27 +02:00
parent db647a72fe
commit 4efc4c1cab
2 changed files with 9 additions and 13 deletions
@@ -523,9 +523,7 @@ describe('<UserListPicker />', () => {
return mockQueryEntitiesImplementation(request);
});
render(
<Picker initialFilter="owned" />,
); /* picker({ loading: true })*/
render(<Picker initialFilter="owned" />);
await waitFor(() =>
expect(mockCatalogApi.queryEntities).toHaveBeenCalledTimes(3),
@@ -566,9 +564,7 @@ describe('<UserListPicker />', () => {
return mockQueryEntitiesImplementation(request);
});
render(
<Picker initialFilter="starred" />,
); /* picker({ loading: true })*/
render(<Picker initialFilter="starred" />);
await waitFor(() =>
expect(mockCatalogApi.queryEntities).toHaveBeenCalledTimes(3),
@@ -587,7 +583,10 @@ describe('<UserListPicker />', () => {
await waitFor(() =>
expect(updateFilters).toHaveBeenLastCalledWith({
user: EntityUserListFilter.starred(expect.any(Array)),
user: EntityUserListFilter.starred([
'component:default/e-1',
'component:default/e-2',
]),
}),
);
});
+3 -6
View File
@@ -241,11 +241,11 @@ export class EntityUserListFilter implements EntityFilter {
// This is supposed to return always true for paginated
// owned entities, since the filters are applied server side.
if (this.value === 'owned') {
const relations = getEntityRelations(entity, RELATION_OWNED_BY);
return (
this.refs?.some(v =>
getEntityRelations(entity, RELATION_OWNED_BY).some(
o => stringifyEntityRef(o) === v,
),
relations.some(o => stringifyEntityRef(o) === v),
) ?? false
);
}
@@ -309,9 +309,6 @@ export class EntityOrphanFilter implements EntityFilter {
export class EntityErrorFilter implements EntityFilter {
constructor(readonly value: boolean) {}
// TODO(vinzscam): is it possible to implement
// getCatalogFilters? ask mammals
filterEntity(entity: Entity): boolean {
const error =
((entity as AlphaEntity)?.status?.items?.length as number) > 0;