Skip to content

Commit

Permalink
[EN-6259] feat: back office admin offres
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulEntourage committed Nov 23, 2023
1 parent 479aba3 commit 713a16c
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tests/opportunities/opportunities.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,56 @@ describe('Opportunities', () => {
expect.arrayContaining(response.body.map(({ id }) => id))
);
});
it('Should return 200 and 2 first opportunities', async () => {
const firstOpportunity = await opportunityFactory.create({});

const secondpportunity = await opportunityFactory.create({});

await opportunityFactory.create({});

await opportunityFactory.create({});

const expectedOpportunitiesId = [
firstOpportunity.id,
secondpportunity.id,
];

const response: APIResponse<OpportunitiesController['findAll']> =
await request(app.getHttpServer())
.get(`${route}/admin?limit=2&offset=0`)
.set('authorization', `Token ${loggedInAdmin.token}`);
expect(response.status).toBe(200);
expect(response.body.length).toBe(2);
expect(expectedOpportunitiesId).toEqual(
expect.arrayContaining(response.body.map(({ id }) => id))
);
});
it('Should return 200 and third and fourth opportunities', async () => {

await opportunityFactory.create({});

await opportunityFactory.create({});

const thirdOpportunity = await opportunityFactory.create({});

const fourthpportunity = await opportunityFactory.create({});

const expectedOpportunitiesId = [
thirdOpportunity.id,
fourthpportunity.id,
];


const response: APIResponse<OpportunitiesController['findAll']> =
await request(app.getHttpServer())
.get(`${route}/admin?limit=2&offset=1`)
.set('authorization', `Token ${loggedInAdmin.token}`);
expect(response.status).toBe(200);
expect(response.body.length).toBe(2);
expect(expectedOpportunitiesId).toEqual(
expect.arrayContaining(response.body.map(({ id }) => id))
);
});
it('Should return 200, and all the opportunities that matches the search query', async () => {
const searchedOpportunity = await opportunityFactory.create({
title: 'XXXXX',
Expand Down

0 comments on commit 713a16c

Please sign in to comment.