import { CommentAddedEvent } from '@task-stream/api/tracker/domain'; import { lastValueFrom, of, toArray } from 'rxjs'; import { WatchIssueCommand } from '../commands/watch-issue.command'; import { CommentersFollowSaga } from './commenters-follow.saga'; describe('CommentersFollowSaga', () => { it('makes whoever comments follow the ticket', async () => { const event = new CommentAddedEvent('ana', { id: 'c-1', issueId: 'i-1', projectId: 'p-1', authorId: 'ana', body: 'Lo miro', replyTo: null, deleted: false, createdAt: '2026-10-08T10:00:00.000Z', editedAt: null, }); const commands = await lastValueFrom( new CommentersFollowSaga().commented(of(event)).pipe(toArray()), ); expect(commands).toEqual([new WatchIssueCommand('ana', 'i-1', 'ana')]); }); });