@@ -18,11 +18,8 @@ describe('code-header plugin', () => {
1818
1919 const html = await renderContent ( markdown )
2020
21- // Should keep copilot as the language (not convert to text without copy meta)
2221 expect ( html ) . toContain ( 'language-copilot' )
23- // Should NOT wrap in code-example div since no copy meta
2422 expect ( html ) . not . toContain ( 'code-example' )
25- // Should NOT have header since no copy meta
2623 expect ( html ) . not . toContain ( '<header' )
2724 } )
2825
@@ -31,13 +28,10 @@ describe('code-header plugin', () => {
3128
3229 const html = await renderContent ( markdown )
3330
34- // Should be wrapped in code-example div
3531 expect ( html ) . toContain ( 'code-example' )
36- // Should have header with copy button
3732 expect ( html ) . toContain ( '<header' )
3833 expect ( html ) . toContain ( 'js-btn-copy' )
3934 expect ( html ) . toContain ( 'language-copilot' )
40- // Should NOT have prompt button (no prompt meta)
4135 expect ( html ) . not . toContain ( 'https://github.com/copilot?prompt=' )
4236 } )
4337
@@ -46,14 +40,10 @@ describe('code-header plugin', () => {
4640
4741 const html = await renderContent ( markdown )
4842
49- // Should be wrapped in code-example div
5043 expect ( html ) . toContain ( 'code-example' )
51- // Should have header
5244 expect ( html ) . toContain ( '<header' )
53- // Should have prompt button
5445 expect ( html ) . toContain ( 'https://github.com/copilot?prompt=' )
5546 expect ( html ) . toContain ( 'language-copilot' )
56- // Should NOT have copy button
5747 expect ( html ) . not . toContain ( 'js-btn-copy' )
5848 } )
5949
@@ -62,15 +52,11 @@ describe('code-header plugin', () => {
6252
6353 const html = await renderContent ( markdown )
6454
65- // Should be wrapped in code-example div
6655 expect ( html ) . toContain ( 'code-example' )
67- // Should have header with copy button
6856 expect ( html ) . toContain ( '<header' )
6957 expect ( html ) . toContain ( 'js-btn-copy' )
70- // Should have prompt button with encoded URL
7158 expect ( html ) . toContain ( 'https://github.com/copilot?prompt=' )
7259 expect ( html ) . toContain ( 'Improve%20the%20variable%20names%20in%20this%20function' )
73- // Should have Copilot icon button
7460 expect ( html ) . toContain ( 'aria-label="Run this prompt in Copilot Chat"' )
7561 expect ( html ) . toContain ( 'language-copilot' )
7662 } )
@@ -94,12 +80,9 @@ Improve the variable names in this function
9480
9581 const html = await renderContent ( markdown )
9682
97- // Should have prompt button with both code blocks in URL
9883 expect ( html ) . toContain ( 'https://github.com/copilot?prompt=' )
99- // Should contain encoded content from both the referenced code and the prompt
10084 expect ( html ) . toContain ( 'function%20logPersonsAge' )
10185 expect ( html ) . toContain ( 'Improve%20the%20variable%20names' )
102- // Should have different aria-label indicating context
10386 expect ( html ) . toContain ( 'aria-label="Run this prompt with context in Copilot Chat"' )
10487 } )
10588
@@ -122,14 +105,10 @@ Improve the variable names in this function
122105
123106 const html = await renderContent ( markdown )
124107
125- // Should have prompt button with both code blocks in URL
126108 expect ( html ) . toContain ( 'https://github.com/copilot?prompt=' )
127- // Should contain encoded content from both the referenced code and the prompt
128109 expect ( html ) . toContain ( 'function%20logPersonsAge' )
129110 expect ( html ) . toContain ( 'Improve%20the%20variable%20names' )
130- // Should have different aria-label indicating context
131111 expect ( html ) . toContain ( 'aria-label="Run this prompt with context in Copilot Chat"' )
132- // Should NOT have copy button
133112 expect ( html ) . not . toContain ( 'js-btn-copy' )
134113 } )
135114 } )
@@ -143,19 +122,14 @@ Improve the variable names in this function
143122
144123 const html = await renderContent ( markdown )
145124
146- // Should warn about missing reference via structured logger
147125 expect ( mockWarn ) . toHaveBeenCalledWith ( 'Cannot find referenced code block' , {
148126 ref : 'nonexistent-id' ,
149127 } )
150128
151- // Should still render with prompt button using current code only
152129 expect ( html ) . toContain ( 'https://github.com/copilot?prompt=' )
153130 expect ( html ) . toContain ( 'Improve%20the%20variable%20names%20in%20this%20function' )
154- // Should NOT contain any referenced code since none was found
155131 expect ( html ) . not . toContain ( 'function%20logPersonsAge' )
156- // Should have standard aria-label (not context version)
157132 expect ( html ) . toContain ( 'aria-label="Run this prompt in Copilot Chat"' )
158- // Should not crash or fail
159133 expect ( html ) . toContain ( 'code-example' )
160134
161135 mockWarn . mockClear ( )
@@ -169,7 +143,6 @@ function test() {}
169143
170144 const html = await renderContent ( markdown )
171145
172- // Should NOT wrap in code-example div (annotated blocks are excluded)
173146 expect ( html ) . not . toContain ( 'code-example' )
174147 } )
175148
@@ -178,7 +151,6 @@ function test() {}
178151
179152 const html = await renderContent ( markdown )
180153
181- // Should render with copy button
182154 expect ( html ) . toContain ( 'code-example' )
183155 expect ( html ) . toContain ( 'js-btn-copy' )
184156 expect ( html ) . toContain ( 'language-javascript' )
@@ -191,7 +163,6 @@ function test() {}
191163
192164 const html = await renderContent ( markdown )
193165
194- // Should encode quotes and ampersands properly
195166 expect ( html ) . toContain ( '%22quotes%22' )
196167 expect ( html ) . toContain ( '%26%20symbols' )
197168 } )
@@ -204,7 +175,6 @@ This is line 2
204175
205176 const html = await renderContent ( markdown )
206177
207- // Should encode newlines properly
208178 expect ( html ) . toContain ( 'This%20is%20line%201%0AThis%20is%20line%202' )
209179 } )
210180 } )
0 commit comments