@@ -4,7 +4,7 @@ import * as sinon from "sinon";
44import * as api from "../api-client" ;
55import { getRunnerLogger } from "../logging" ;
66import { parseRepositoryNwo } from "../repository" ;
7- import { setupTests } from "../testing-utils" ;
7+ import { RecordingLogger , setupTests } from "../testing-utils" ;
88
99import * as properties from "./properties" ;
1010
@@ -197,3 +197,38 @@ test.serial(
197197 ) ;
198198 } ,
199199) ;
200+
201+ test . serial (
202+ "loadPropertiesFromApi warns if a repository property name starts with the common prefix, but is not recognised by us" ,
203+ async ( t ) => {
204+ process . env [ "GITHUB_EVENT_NAME" ] = "push" ;
205+ const propertyName : string = `${ properties . GITHUB_CODEQL_PROPERTY_PREFIX } unknown` ;
206+ sinon . stub ( api , "getRepositoryProperties" ) . resolves ( {
207+ headers : { } ,
208+ status : 200 ,
209+ url : "" ,
210+ data : [
211+ {
212+ property_name : propertyName ,
213+ value : "true" ,
214+ } ,
215+ ] satisfies properties . GitHubPropertiesResponse ,
216+ } ) ;
217+ const logger = new RecordingLogger ( ) ;
218+ const warningSpy = sinon . spy ( logger , "warning" ) ;
219+ const mockRepositoryNwo = parseRepositoryNwo ( "owner/repo" ) ;
220+ const response = await properties . loadPropertiesFromApi (
221+ logger ,
222+ mockRepositoryNwo ,
223+ ) ;
224+ t . deepEqual ( response , { } ) ;
225+ t . true ( warningSpy . calledOnce ) ;
226+ t . assert (
227+ warningSpy . firstCall . args [ 0 ]
228+ . toString ( )
229+ . startsWith (
230+ `Found a repository property named '${ propertyName } ', which looks like a CodeQL Action repository property` ,
231+ ) ,
232+ ) ;
233+ } ,
234+ ) ;
0 commit comments