Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
guillobits committed Nov 25, 2024
1 parent 4f05a67 commit 46e18ae
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions tests/users/users.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2390,14 +2390,33 @@ describe('Users', () => {
);
});

it('Should return 400, when try to list members with role referer', async () => {
it('Should return 200, and all the referers that match all the filters', async () => {
const organization = await organizationFactory.create({}, {}, true);

const referers = await databaseHelper.createEntities(
userFactory,
2,
{
firstName: 'XXX',
role: UserRoles.REFERER,
zone: AdminZones.LYON,
OrganizationId: organization.id,
}
);

const expectedCoachesIds = [...referers.map(({ id }) => id)];

const response: APIResponse<UsersController['findMembers']> =
await request(server)
.get(
`${route}/members?limit=50&offset=0&role[]=${UserRoles.REFERER}&query=XXX&zone[]=${AdminZones.LYON}&associatedUser[]=true`
`${route}/members?limit=50&offset=0&role[]=${UserRoles.REFERER}&query=XXX&zone[]=${AdminZones.LYON}`
)
.set('authorization', `Bearer ${loggedInAdmin.token}`);
expect(response.status).toBe(400);
expect(response.status).toBe(200);
expect(response.body.length).toBe(2);
expect(expectedCoachesIds).toEqual(
expect.arrayContaining(response.body.map(({ id }) => id))
);
});
});
});
Expand Down

0 comments on commit 46e18ae

Please sign in to comment.