@@ -8,18 +8,23 @@ const runModule = require("./maintainer-approval");
88
99// --- Test helpers ---
1010
11- function makeTmpOwners ( content ) {
11+ function makeTmpOwners ( content , ownerTeamsContent ) {
1212 const tmpDir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "approval-test-" ) ) ;
1313 const ghDir = path . join ( tmpDir , ".github" ) ;
1414 fs . mkdirSync ( ghDir ) ;
1515 fs . writeFileSync ( path . join ( ghDir , "OWNERS" ) , content ) ;
16+ if ( ownerTeamsContent ) {
17+ fs . writeFileSync ( path . join ( ghDir , "OWNERTEAMS" ) , ownerTeamsContent ) ;
18+ }
1619 return tmpDir ;
1720}
1821
22+ const OWNERTEAMS_CONTENT = "team:eng-apps-devex @teamdev1 @teamdev2\n" ;
23+
1924const OWNERS_CONTENT = [
2025 "* @maintainer1 @maintainer2" ,
2126 "/cmd/pipelines/ @jefferycheng1 @kanterov" ,
22- "/cmd/apps/ @databricks/ eng-apps-devex" ,
27+ "/cmd/apps/ team: eng-apps-devex" ,
2328 "/bundle/ @bundleowner" ,
2429] . join ( "\n" ) ;
2530
@@ -121,7 +126,7 @@ describe("maintainer-approval", () => {
121126
122127 before ( ( ) => {
123128 originalWorkspace = process . env . GITHUB_WORKSPACE ;
124- tmpDir = makeTmpOwners ( OWNERS_CONTENT ) ;
129+ tmpDir = makeTmpOwners ( OWNERS_CONTENT , OWNERTEAMS_CONTENT ) ;
125130 process . env . GITHUB_WORKSPACE = tmpDir ;
126131 } ) ;
127132
@@ -283,13 +288,12 @@ describe("maintainer-approval", () => {
283288 assert . equal ( github . _checkRuns . length , 0 ) ;
284289 } ) ;
285290
286- it ( "team member approved -> success for team-owned path" , async ( ) => {
291+ it ( "OWNERTEAMS member approved -> success for team-owned path" , async ( ) => {
287292 const github = makeGithub ( {
288293 reviews : [
289294 { state : "APPROVED" , user : { login : "teamdev1" } } ,
290295 ] ,
291296 files : [ { filename : "cmd/apps/main.go" } ] ,
292- teamMembers : { "eng-apps-devex" : [ "teamdev1" ] } ,
293297 } ) ;
294298 const core = makeCore ( ) ;
295299 const context = makeContext ( ) ;
@@ -300,13 +304,12 @@ describe("maintainer-approval", () => {
300304 assert . equal ( github . _checkRuns [ 0 ] . conclusion , "success" ) ;
301305 } ) ;
302306
303- it ( "non-team -member approval for team-owned path -> pending" , async ( ) => {
307+ it ( "non-OWNERTEAMS -member approval for team-owned path -> pending" , async ( ) => {
304308 const github = makeGithub ( {
305309 reviews : [
306310 { state : "APPROVED" , user : { login : "outsider" } } ,
307311 ] ,
308312 files : [ { filename : "cmd/apps/main.go" } ] ,
309- teamMembers : { "eng-apps-devex" : [ ] } ,
310313 } ) ;
311314 const core = makeCore ( ) ;
312315 const context = makeContext ( ) ;
0 commit comments