File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
src/webviews/components/issue/common Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments