Skip to content

Commit

Permalink
chore: increase coverage on template_nine api
Browse files Browse the repository at this point in the history
  • Loading branch information
AntBush committed Mar 7, 2025
1 parent cd123b8 commit f2dcd77
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions app/tests/backend/lib/excel_import/template_nine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,4 +342,52 @@ describe('The Community Progress Report import', () => {

expect(response.status).toBe(200);
});

it('should reject if a guest tries to process applicant rfi endpoint', async () => {
mocked(getAuthRole).mockImplementation(() => {
return {
pgRole: 'ccbc_guest',
landingRoute: '/',
};
});

const response = await request(app).post(
'/api/template-nine/rfi/applicant/1/CCBC-00001-1'
);

expect(response.status).toBe(404);
});

it('should return 400 if an applicant tries to process bad file', async () => {
mocked(getAuthRole).mockImplementation(() => {
return {
pgRole: 'ccbc_auth_user',
landingRoute: '/',
};
});

const response = await request(app)
.post('/api/template-nine/rfi/applicant/1/CCBC-00001-1')
.set('Content-Type', 'application/json')
.set('Connection', 'keep-alive')
.field('data', JSON.stringify({ name: 'form' }))
.attach('template9', null);

expect(response.status).toBe(400);
});

it('should return 400 if an applicant tries to hit endpoint with bad parameters', async () => {
mocked(getAuthRole).mockImplementation(() => {
return {
pgRole: 'ccbc_auth_user',
landingRoute: '/',
};
});

const response = await request(app).post(
'/api/template-nine/rfi/applicant/null/rfi'
);

expect(response.status).toBe(400);
});
});

0 comments on commit f2dcd77

Please sign in to comment.