test(tasks): Add unit tests for TasksService in the productivity module

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-03-25 23:19:59 -07:00
parent a3cefc5e7a
commit 7f5063c65d

View file

@ -7,9 +7,13 @@ import { Task } from '../entities/task.entity';
import { TaskCompletedEvent } from '@common/events';
import { mockRepository, MockRepository } from '@test-helpers/mock-repository';
import { makeTask } from '@test-helpers/factories';
import { ProjectResolverService } from '@features/projects/backend/project-resolver.service';
import { ProjectResolverService } from '@projects/productivity/projects/backend/project-resolver.service';
import { mockProjectResolverService, MockProjectResolverService } from '@test-helpers/mock-project-resolver';
jest.mock('@common/resolve-short-id', () => ({
resolveShortId: jest.fn(async (_repo: unknown, id: string) => id),
}));
const UUID_1 = 'a1b2c3d4-1111-2222-3333-444455556666';
const UUID_2 = 'b2c3d4e5-2222-3333-4444-555566667777';
const UUID_DOM1 = 'c3d4e5f6-3333-4444-5555-666677778888';
@ -442,7 +446,7 @@ describe('TasksService', () => {
await service.updateStatus(UUID_1, { status: 'in_progress' } as never);
expect(eventEmitter.emit).not.toHaveBeenCalled();
expect(eventEmitter.emit).not.toHaveBeenCalledWith('task.completed', expect.anything());
});
it('should throw NotFoundException if task does not exist', async () => {