fix: Flip templateFilter to match Array.filter
Signed-off-by: Jack Palmer <jackpalmer@spotify.com>
This commit is contained in:
@@ -214,7 +214,7 @@ describe('TemplateGroups', () => {
|
||||
|
||||
expect(TemplateGroup).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
templates: [expect.objectContaining({ template: mockEntities[1] })],
|
||||
templates: [expect.objectContaining({ template: mockEntities[0] })],
|
||||
}),
|
||||
{},
|
||||
);
|
||||
|
||||
@@ -91,7 +91,7 @@ export const TemplateGroups = (props: TemplateGroupsProps) => {
|
||||
{groups.map(({ title, filter }, index) => {
|
||||
const templates = entities
|
||||
.filter(isTemplateEntityV1beta3)
|
||||
.filter(e => (templateFilter ? !templateFilter(e) : true))
|
||||
.filter(e => (templateFilter ? templateFilter(e) : true))
|
||||
.filter(filter)
|
||||
.map(template => {
|
||||
const additionalLinks =
|
||||
|
||||
@@ -77,7 +77,7 @@ describe('TemplateList', () => {
|
||||
{ mountedRoutes: { '/': rootRouteRef } },
|
||||
);
|
||||
|
||||
expect(() => screen.getByTestId('t1')).toThrow();
|
||||
expect(screen.getByTestId('t2')).toBeDefined();
|
||||
expect(() => screen.getByTestId('t2')).toThrow();
|
||||
expect(screen.getByTestId('t1')).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ export const TemplateList = ({
|
||||
const templateEntities = entities.filter(isTemplateEntityV1beta3);
|
||||
const maybeFilteredEntities = (
|
||||
group ? templateEntities.filter(group.filter) : templateEntities
|
||||
).filter(e => (templateFilter ? !templateFilter(e) : true));
|
||||
).filter(e => (templateFilter ? templateFilter(e) : true));
|
||||
|
||||
const titleComponent: React.ReactNode = (() => {
|
||||
if (group && group.title) {
|
||||
|
||||
Reference in New Issue
Block a user