Skip to content

Commit

Permalink
chore: add tests for campaign application file fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
gparlakov committed Sep 29, 2024
1 parent baf0689 commit 5bbef05
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,9 @@ describe('CampaignApplicationService', () => {
prismaMock.campaignApplication.findFirst.mockResolvedValue(mockSingleCampaignApplication)
await expect(
service.getFile('id', false, { ...mockPerson, organizer: { id: 'different-id' } }),
).rejects.toThrow(new ForbiddenException('User is not admin or organizer of the campaignApplication'))
).rejects.toThrow(
new ForbiddenException('User is not admin or organizer of the campaignApplication'),
)
})

it('should allow admin users to see files belonging to other users', async () => {
Expand All @@ -496,7 +498,9 @@ describe('CampaignApplicationService', () => {
} as File)
await expect(
service.getFile('id', true, { ...mockPerson, organizer: { id: 'different-id' } }),
).resolves.not.toThrow(new ForbiddenException('User is not admin or organizer of the campaignApplication'))
).resolves.not.toThrow(
new ForbiddenException('User is not admin or organizer of the campaignApplication'),
)
})
})
})

0 comments on commit 5bbef05

Please sign in to comment.