@@ -134,7 +134,7 @@ describe('changelog', () => {
134134 ) ;
135135 } ) ;
136136
137- it ( 'places metadata on the first line and does not append it after code blocks' , async ( ) => {
137+ it ( 'places metadata on the first line and preserves markdown code blocks' , async ( ) => {
138138 const summary = [
139139 'refactor(config): replace `off` with null to disable options' ,
140140 '' ,
@@ -167,12 +167,21 @@ describe('changelog', () => {
167167 expect ( line ) . toMatch (
168168 / ^ \n - r e f a c t o r \( c o n f i g \) : r e p l a c e ` o f f ` w i t h n u l l t o d i s a b l e o p t i o n s \( \[ # 1 6 1 3 \] \( h t t p s : \/ \/ g i t h u b .c o m \/ h e y - a p i \/ o p e n a p i - t s \/ p u l l \/ 1 6 1 3 \) \) \( \[ ` f c d d 7 3 b ` \] \( h t t p s : \/ \/ g i t h u b .c o m \/ h e y - a p i \/ o p e n a p i - t s \/ c o m m i t \/ f c d d 7 3 b 8 1 6 d 7 4 b a b f 4 7 e 6 a 1 f 4 6 0 3 2 f 5 b 8 e b b 4 b 4 8 \) \) b y \[ @ s o m e o n e \] \( h t t p s : \/ \/ g i t h u b .c o m \/ s o m e o n e \) / ,
169169 ) ;
170- // There should be no metadata at the end
171- expect ( line . trim ( ) . endsWith ( '```' ) ) . toBe ( false ) ;
172170 // Should not contain quadruple backticks
173171 expect ( line ) . not . toContain ( '````' ) ;
174- // Should contain indented code block
175- expect ( line ) . toContain ( ' export default {' ) ;
172+ // Should contain a markdown code block
173+ expect ( line ) . toContain ( '```js\nexport default {' ) ;
174+ expect ( line ) . toContain (
175+ ' input: "hey-api/backend", // sign up at app.heyapi.dev' ,
176+ ) ;
177+ expect ( line ) . toContain ( ' output: {' ) ;
178+ expect ( line ) . toContain ( ' format: null,' ) ;
179+ expect ( line ) . toContain ( ' lint: null,' ) ;
180+ expect ( line ) . toContain ( ' path: "src/client",' ) ;
181+ expect ( line ) . toContain ( ' tsConfigPath: null,' ) ;
182+ expect ( line ) . toContain ( ' },' ) ;
183+ expect ( line ) . toContain ( '};' ) ;
184+ expect ( line ) . toContain ( '```' ) ;
176185 } ) ;
177186
178187 it ( 'converts multiple code blocks and preserves non-code content' , async ( ) => {
@@ -198,10 +207,9 @@ describe('changelog', () => {
198207 const line = await changelog . getReleaseLine ( changeset , 'minor' , {
199208 repo : 'hey-api/openapi-ts' ,
200209 } ) ;
201- expect ( line ) . toContain ( ' console .log(1);' ) ;
202- expect ( line ) . toContain ( ' console .log(2);' ) ;
210+ expect ( line ) . toContain ( '```js\nconsole .log(1);\n``` ' ) ;
211+ expect ( line ) . toContain ( '```ts\nconsole .log(2);\n``` ' ) ;
203212 expect ( line ) . toContain ( 'Some text.' ) ;
204- expect ( line ) . not . toContain ( '```' ) ;
205213 } ) ;
206214
207215 describe . each ( [ 'author' , 'user' ] ) (
0 commit comments