diff --git a/src/backend/tests/unmocked/users.test.ts b/src/backend/tests/unmocked/users.test.ts index 941f25137d..4feedbd050 100644 --- a/src/backend/tests/unmocked/users.test.ts +++ b/src/backend/tests/unmocked/users.test.ts @@ -2,6 +2,7 @@ import { Organization } from '@prisma/client'; import { createTestOrganization, createTestTask, createTestUser, resetUsers } from '../test-utils'; import { batmanAppAdmin } from '../test-data/users.test-data'; import UsersService from '../../src/services/users.services'; +import { NotFoundException } from '../../src/utils/errors.utils'; describe('User Tests', () => { let orgId: string; @@ -15,11 +16,15 @@ describe('User Tests', () => { await resetUsers(); }); - describe('Get Users Tasks', () => { - it("Succeeds and gets user's assigned tasks", async () => { - const testBatman = await createTestUser(batmanAppAdmin, orgId); - const { task } = await createTestTask(testBatman, organization); + describe('Get Users Tasks', async () => { + const testBatman = await createTestUser(batmanAppAdmin, orgId); + const { task } = await createTestTask(testBatman, organization); + + it('fails on invalid user id', async () => { + expect(UsersService.getUserTasks('1', organization)).rejects.toThrow(new NotFoundException('User', '1')); + }); + it("Succeeds and gets user's assigned tasks", async () => { const userTasks = await UsersService.getUserTasks(testBatman.userId, organization); expect(userTasks).toStrictEqual([task]);