@@ -134,7 +134,7 @@ describe('changelog', () => {
134
134
) ;
135
135
} ) ;
136
136
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 ( ) => {
138
138
const summary = [
139
139
'refactor(config): replace `off` with null to disable options' ,
140
140
'' ,
@@ -167,12 +167,21 @@ describe('changelog', () => {
167
167
expect ( line ) . toMatch (
168
168
/ ^ \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 \) / ,
169
169
) ;
170
- // There should be no metadata at the end
171
- expect ( line . trim ( ) . endsWith ( '```' ) ) . toBe ( false ) ;
172
170
// Should not contain quadruple backticks
173
171
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 ( '```' ) ;
176
185
} ) ;
177
186
178
187
it ( 'converts multiple code blocks and preserves non-code content' , async ( ) => {
@@ -198,10 +207,9 @@ describe('changelog', () => {
198
207
const line = await changelog . getReleaseLine ( changeset , 'minor' , {
199
208
repo : 'hey-api/openapi-ts' ,
200
209
} ) ;
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``` ' ) ;
203
212
expect ( line ) . toContain ( 'Some text.' ) ;
204
- expect ( line ) . not . toContain ( '```' ) ;
205
213
} ) ;
206
214
207
215
describe . each ( [ 'author' , 'user' ] ) (
0 commit comments