- Added messageId and timestamp fields to CrossTeamSendRequest for better message tracking. - Updated CrossTeamService to utilize these fields when sending messages, ensuring consistent message identity. - Enhanced TeamProvisioningService to support cross-team sender functionality, allowing for improved message handling. - Introduced parsing for cross-team reply prefixes to manage threaded conversations effectively. - Updated tests to validate the inclusion of messageId and timestamp in cross-team messages.
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import {
|
|
parseCrossTeamPrefix,
|
|
parseCrossTeamReplyPrefix,
|
|
stripCrossTeamPrefix,
|
|
} from '@shared/constants/crossTeam';
|
|
|
|
describe('crossTeam protocol helpers', () => {
|
|
it('parses canonical cross-team prefix metadata', () => {
|
|
const parsed = parseCrossTeamPrefix(
|
|
'[Cross-team from dream-team.team-lead | depth:0 | conversation:conv-1 | replyTo:conv-0]\nHello'
|
|
);
|
|
|
|
expect(parsed).toEqual({
|
|
from: 'dream-team.team-lead',
|
|
chainDepth: 0,
|
|
conversationId: 'conv-1',
|
|
replyToConversationId: 'conv-0',
|
|
});
|
|
});
|
|
|
|
it('parses manual cross-team reply prefix metadata', () => {
|
|
const parsed = parseCrossTeamReplyPrefix(
|
|
'[Cross-team reply | conversation:conv-1 | replyTo:conv-1]\nHello'
|
|
);
|
|
|
|
expect(parsed).toEqual({
|
|
conversationId: 'conv-1',
|
|
replyToConversationId: 'conv-1',
|
|
});
|
|
});
|
|
|
|
it('strips both canonical and reply prefixes from UI text', () => {
|
|
expect(stripCrossTeamPrefix('[Cross-team from a.b | depth:0 | conversation:conv-1]\nHello')).toBe(
|
|
'Hello'
|
|
);
|
|
expect(stripCrossTeamPrefix('[Cross-team reply | conversation:conv-1]\nHello')).toBe('Hello');
|
|
});
|
|
});
|