@@ -20,7 +20,7 @@ const validFlags = [
2020 "--body" ,
2121 "hello" ,
2222 "--marker" ,
23- "<!-- marker --> " ,
23+ "marker" ,
2424 "--issue-id" ,
2525 "42" ,
2626 "--repository" ,
@@ -48,7 +48,7 @@ describe("parseOptions", async () => {
4848 const options = parseOptions ( validFlags ) ;
4949 assert . deepEqual ( options , {
5050 body : "hello" ,
51- marker : "<!-- marker --> " ,
51+ marker : "marker" ,
5252 issueId : 42 ,
5353 repository : { owner : "github" , repo : "codeql-action" } ,
5454 } ) ;
@@ -136,7 +136,7 @@ describe("findExistingComment", async () => {
136136 client ,
137137 { owner : "owner" , repo : "repo" } ,
138138 1 ,
139- "<!-- marker --> " ,
139+ "marker" ,
140140 ) ;
141141 assert . equal ( id , 2 ) ;
142142 } ) ;
@@ -147,7 +147,7 @@ describe("findExistingComment", async () => {
147147 client ,
148148 { owner : "owner" , repo : "repo" } ,
149149 1 ,
150- "<!-- marker --> " ,
150+ "marker" ,
151151 ) ;
152152 assert . equal ( id , undefined ) ;
153153 } ) ;
@@ -156,7 +156,7 @@ describe("findExistingComment", async () => {
156156/** A baseline set of `Options`, for use in `setComment` tests. */
157157const baseOptions : Options = {
158158 body : "hello" ,
159- marker : "<!-- marker --> " ,
159+ marker : "marker" ,
160160 issueId : 42 ,
161161 repository : { owner : "owner" , repo : "repo" } ,
162162} ;
@@ -166,16 +166,16 @@ function assertCommentContent(
166166 marker : string ,
167167 body : string ,
168168) : void {
169- assert . ok ( comment . body ?. startsWith ( marker ) ) ;
169+ assert . ok ( comment . body ?. startsWith ( `<!-- ${ marker } -->` ) ) ;
170170 assert . ok ( comment . body ?. endsWith ( body ) ) ;
171171}
172172
173173describe ( "setComment" , async ( ) => {
174174 await it ( "uses the supplied marker without affecting other comments" , async ( ) => {
175- const marker = "<!-- custom-warning --> " ;
175+ const marker = "custom-warning" ;
176176 const { client, comments } = fakeClient ( [
177- { id : 1 , body : ` ${ baseOptions . marker } \nunrelated warning` } ,
178- { id : 2 , body : ` ${ marker } \nold warning` } ,
177+ { id : 1 , body : "<!-- marker --> \nunrelated warning" } ,
178+ { id : 2 , body : "<!-- custom-warning --> \nold warning" } ,
179179 ] ) ;
180180 const options = parseOptions ( withFlag ( "--marker" , marker ) ) ;
181181
@@ -185,7 +185,7 @@ describe("setComment", async () => {
185185 assert . equal ( comments . length , 2 ) ;
186186 assert . deepEqual ( comments [ 0 ] , {
187187 id : 1 ,
188- body : ` ${ baseOptions . marker } \nunrelated warning` ,
188+ body : "<!-- marker --> \nunrelated warning" ,
189189 } ) ;
190190 assert . equal ( comments [ 1 ] . id , 2 ) ;
191191 assertCommentContent ( comments [ 1 ] , marker , options . body ) ;
@@ -196,7 +196,7 @@ describe("setComment", async () => {
196196 // No comment has the marker before posting.
197197 assert . equal ( comments . length , 0 ) ;
198198 assert . ok (
199- ! comments . some ( ( { body } ) => body ?. startsWith ( baseOptions . marker ) ) ,
199+ ! comments . some ( ( { body } ) => body ?. startsWith ( "<!-- marker -->" ) ) ,
200200 ) ;
201201
202202 await setComment ( client , baseOptions ) ;
@@ -214,7 +214,7 @@ describe("setComment", async () => {
214214 const { client, comments } = fakeClient ( originalComments ) ;
215215 // Existing comments do not match the marker.
216216 assert . ok (
217- ! comments . some ( ( { body } ) => body ?. startsWith ( baseOptions . marker ) ) ,
217+ ! comments . some ( ( { body } ) => body ?. startsWith ( "<!-- marker -->" ) ) ,
218218 ) ;
219219
220220 await setComment ( client , baseOptions ) ;
@@ -226,7 +226,7 @@ describe("setComment", async () => {
226226 originalComments ,
227227 ) ;
228228 const markedComments = comments . filter ( ( { body } ) =>
229- body ?. startsWith ( baseOptions . marker ) ,
229+ body ?. startsWith ( "<!-- marker -->" ) ,
230230 ) ;
231231 // Exactly one comment contains the expected marker and body.
232232 assert . equal ( markedComments . length , 1 ) ;
@@ -241,7 +241,7 @@ describe("setComment", async () => {
241241
242242 await it ( "updates the existing comment when one is found" , async ( ) => {
243243 const { client, comments } = fakeClient ( [
244- { id : 7 , body : ` ${ baseOptions . marker } \nold` } ,
244+ { id : 7 , body : "<!-- marker --> \nold" } ,
245245 ] ) ;
246246
247247 await setComment ( client , baseOptions ) ;
@@ -254,7 +254,7 @@ describe("setComment", async () => {
254254
255255 await it ( "replaces a warning with the resolved state using the same marker" , async ( ) => {
256256 const { client, comments } = fakeClient ( [
257- { id : 9 , body : ` ${ baseOptions . marker } \nold` } ,
257+ { id : 9 , body : "<!-- marker --> \nold" } ,
258258 ] ) ;
259259 const body =
260260 "`CHANGELOG.md` is not modified in this PR. No changelog action is needed." ;
0 commit comments