Skip to content

Commit cdd0107

Browse files
committed
AXON-1713: added test of the valid mention structure
1 parent 9993201 commit cdd0107

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/webviews/components/issue/common/adfToWikimarkup.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,25 @@ describe('adfToWikimarkup', () => {
149149
expect(resultStr).toContain('"id":"user-abc"');
150150
});
151151

152+
it('should produce valid mention structure for Jira API v3', () => {
153+
// This test documents the exact ADF structure required by Jira API v3
154+
const wikimarkup = '[~accountid:user-id-123]';
155+
const result = convertWikimarkupToAdf(wikimarkup);
156+
157+
// Find the mention node in the ADF
158+
const paragraph = result.content?.[0];
159+
const mentionNode = paragraph?.content?.find((node: any) => node.type === 'mention');
160+
161+
expect(mentionNode).toBeDefined();
162+
expect(mentionNode!.type).toBe('mention');
163+
// ID must NOT have 'accountid:' prefix - Jira API rejects it
164+
expect(mentionNode!.attrs!.id).toBe('user-id-123');
165+
expect(mentionNode!.attrs!.id).not.toContain('accountid:');
166+
// Must not have null values - Jira API rejects them
167+
expect(mentionNode!.attrs!.localId).toBeUndefined();
168+
expect(mentionNode!.attrs!.userType).toBeUndefined();
169+
});
170+
152171
it('should handle headings', () => {
153172
const wikimarkup = 'h1. Heading';
154173
const result = convertWikimarkupToAdf(wikimarkup);

0 commit comments

Comments
 (0)