Skip to content

Commit

Permalink
♻️(frontend) delete infinite scroll
Browse files Browse the repository at this point in the history
In order to be in agreement with the back, we must modify the front
so as to no longer have infinite scroll in the team part.
It is also necessary to modify the tests accordingly
  • Loading branch information
PanchoutNathan committed Oct 30, 2024
1 parent c42b1f2 commit 96b887e
Showing 1 changed file with 39 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ describe('PanelTeams', () => {
});

it('renders with no team to display', async () => {
fetchMock.mock(`end:/teams/?page=1&ordering=-created_at`, {
count: 0,
results: [],
});
fetchMock.mock(`end:/teams/?ordering=-created_at`, []);

render(<TeamList />, { wrapper: AppWrapper });

Expand All @@ -40,16 +37,13 @@ describe('PanelTeams', () => {
});

it('renders an empty team', async () => {
fetchMock.mock(`end:/teams/?page=1&ordering=-created_at`, {
count: 1,
results: [
{
id: '1',
name: 'Team 1',
accesses: [],
},
],
});
fetchMock.mock(`end:/teams/?ordering=-created_at`, [
{
id: '1',
name: 'Team 1',
accesses: [],
},
]);

render(<TeamList />, { wrapper: AppWrapper });

Expand All @@ -59,21 +53,18 @@ describe('PanelTeams', () => {
});

it('renders a team with only 1 member', async () => {
fetchMock.mock(`end:/teams/?page=1&ordering=-created_at`, {
count: 1,
results: [
{
id: '1',
name: 'Team 1',
accesses: [
{
id: '1',
role: 'owner',
},
],
},
],
});
fetchMock.mock(`end:/teams/?ordering=-created_at`, [
{
id: '1',
name: 'Team 1',
accesses: [
{
id: '1',
role: 'owner',
},
],
},
]);

render(<TeamList />, { wrapper: AppWrapper });

Expand All @@ -83,33 +74,30 @@ describe('PanelTeams', () => {
});

it('renders a non-empty team', () => {
fetchMock.mock(`end:/teams/?page=1&ordering=-created_at`, {
count: 1,
results: [
{
id: '1',
name: 'Team 1',
accesses: [
{
id: '1',
role: 'admin',
},
{
id: '2',
role: 'member',
},
],
},
],
});
fetchMock.mock(`end:/teams/?ordering=-created_at`, [
{
id: '1',
name: 'Team 1',
accesses: [
{
id: '1',
role: 'admin',
},
{
id: '2',
role: 'member',
},
],
},
]);

render(<TeamList />, { wrapper: AppWrapper });

expect(screen.getByRole('status')).toBeInTheDocument();
});

it('renders the error', async () => {
fetchMock.mock(`end:/teams/?page=1&ordering=-created_at`, {
fetchMock.mock(`end:/teams/?ordering=-created_at`, {
status: 500,
});

Expand All @@ -125,10 +113,7 @@ describe('PanelTeams', () => {
});

it('renders with team panel open', async () => {
fetchMock.mock(`end:/teams/?page=1&ordering=-created_at`, {
count: 1,
results: [],
});
fetchMock.mock(`end:/teams/?ordering=-created_at`, []);

render(<Panel />, { wrapper: AppWrapper });

Expand All @@ -140,10 +125,7 @@ describe('PanelTeams', () => {
});

it('closes and opens the team panel', async () => {
fetchMock.get(`end:/teams/?page=1&ordering=-created_at`, {
count: 1,
results: [],
});
fetchMock.get(`end:/teams/?ordering=-created_at`, []);

render(<Panel />, { wrapper: AppWrapper });

Expand Down

0 comments on commit 96b887e

Please sign in to comment.