mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-27 11:02:16 +01:00
This PR removes the previous "my projects" filter in favor always
splitting projects, but showing both on the main screen.
To make it a bit easier to work with, it also moves the project group
component into its own file, causing some extra lines of code change. My
apologies 🙇🏼
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import type { IProjectCard } from 'interfaces/project';
|
|
import { groupProjects } from './group-projects';
|
|
|
|
test('should check that the project is a user project OR that it is a favorite', () => {
|
|
const myProjectIds = new Set(['my1', 'my2', 'my3']);
|
|
|
|
const projects: IProjectCard[] = [
|
|
{ id: 'my1', favorite: true },
|
|
{ id: 'my2', favorite: false },
|
|
{ id: 'my3' },
|
|
{ id: 'fave-but-not-mine', favorite: true },
|
|
{ id: 'not-mine-not-fave', favorite: false },
|
|
{ id: 'not-mine-undefined-fave' },
|
|
].map(({ id, favorite }) => ({
|
|
name: 'name',
|
|
id,
|
|
createdAt: '2024-04-15T11:09:52+02:00',
|
|
health: 100,
|
|
description: 'description',
|
|
featureCount: 100,
|
|
mode: 'open',
|
|
memberCount: 10,
|
|
favorite,
|
|
}));
|
|
|
|
const { myProjects, otherProjects } = groupProjects(myProjectIds, projects);
|
|
|
|
expect(myProjects).toMatchObject([
|
|
{ id: 'my1' },
|
|
{ id: 'my2' },
|
|
{ id: 'my3' },
|
|
{ id: 'fave-but-not-mine' },
|
|
]);
|
|
expect(otherProjects).toMatchObject([
|
|
{ id: 'not-mine-not-fave' },
|
|
{ id: 'not-mine-undefined-fave' },
|
|
]);
|
|
});
|