@@ -3,24 +3,25 @@ import { OctokitResponse } from "@octokit/types";
33import { expect , jest , test } from "@jest/globals" ;
44import { fileURLToPath } from "url" ;
55import { GitNotes } from "../lib/git-notes.js" ;
6- import { getConfig } from "../lib/gitgitgadget-config.js" ;
76import { GitHubGlue } from "../lib/github-glue.js" ;
87import { MailArchiveGitHelper , IGitMailingListMirrorState } from "../lib/mail-archive-helper.js" ;
98import { IMailMetadata } from "../lib/mail-metadata.js" ;
10- import { setConfig } from "../lib/project-config.js" ;
119import { testCreateRepo } from "./test-lib.js" ;
10+ import defaultConfig from "../lib/gitgitgadget-config.js" ;
11+ import { IConfig } from "../lib/project-config.js" ;
1212
1313/* eslint max-classes-per-file: ["error", 2] */
1414
1515class MailArchiveGitHelperProxy extends MailArchiveGitHelper {
1616 public constructor (
17+ config : IConfig ,
1718 gggNotes : GitNotes ,
1819 mailArchiveGitDir : string ,
1920 githubGlue : GitHubGlue ,
2021 state : IGitMailingListMirrorState ,
2122 branch : string ,
2223 ) {
23- super ( gggNotes , mailArchiveGitDir , githubGlue , state , branch ) ;
24+ super ( config , gggNotes , mailArchiveGitDir , githubGlue , state , branch ) ;
2425 }
2526}
2627class GitHubProxy extends GitHubGlue {
@@ -96,10 +97,9 @@ interface ICommit {
9697 parents : [ { sha : string ; url : string ; html_url ?: string } ] ;
9798}
9899
99- const config = getConfig ( ) ;
100+ const config = { ... defaultConfig } ; // make a copy
100101config . repo . owner = "test" ;
101102config . repo . name = "test" ;
102- setConfig ( config ) ;
103103
104104const fromEmail = "I Replied <ireplied@gmail.com>" ;
105105
@@ -205,7 +205,14 @@ This Pull Request contains some ipsum lorem.
205205 const notes = new GitNotes ( repo . workDir ) ;
206206 await notes . set ( mailMeta . messageID , mailMeta , true ) ;
207207
208- const mail = new MailArchiveGitHelperProxy ( notes , repo . workDir , github , { latestRevision : "HEAD~" } , "master" ) ;
208+ const mail = new MailArchiveGitHelperProxy (
209+ config ,
210+ notes ,
211+ repo . workDir ,
212+ github ,
213+ { latestRevision : "HEAD~" } ,
214+ "master" ,
215+ ) ;
209216
210217 const logSpy = jest . spyOn ( console , "log" ) . mockImplementation ( ( ) => { } ) ;
211218 await mail . processMails ( ) ;
@@ -240,7 +247,14 @@ This Pull Request contains some ipsum lorem.
240247 const notes = new GitNotes ( repo . workDir ) ;
241248 await notes . set ( mailMeta . messageID , mailMeta , true ) ;
242249
243- const mail = new MailArchiveGitHelperProxy ( notes , repo . workDir , github , { latestRevision : "HEAD~" } , "master" ) ;
250+ const mail = new MailArchiveGitHelperProxy (
251+ config ,
252+ notes ,
253+ repo . workDir ,
254+ github ,
255+ { latestRevision : "HEAD~" } ,
256+ "master" ,
257+ ) ;
244258
245259 const logSpy = jest . spyOn ( console , "log" ) . mockImplementation ( ( ) => { } ) ;
246260 await mail . processMails ( ) ;
@@ -279,7 +293,14 @@ This Pull Request contains some ipsum lorem.
279293 const notes = new GitNotes ( repo . workDir ) ;
280294 await notes . set ( mailMeta . messageID , mailMeta , true ) ;
281295
282- const mail = new MailArchiveGitHelperProxy ( notes , repo . workDir , github , { latestRevision : "HEAD~" } , "master" ) ;
296+ const mail = new MailArchiveGitHelperProxy (
297+ config ,
298+ notes ,
299+ repo . workDir ,
300+ github ,
301+ { latestRevision : "HEAD~" } ,
302+ "master" ,
303+ ) ;
283304
284305 const commitsResponse = getCommitsResponse ;
285306 const fail = false ;
@@ -365,7 +386,14 @@ This Pull Request contains some ipsum lorem.
365386 const notes = new GitNotes ( repo . workDir ) ;
366387 await notes . set ( mailMeta . messageID , mailMeta , true ) ;
367388
368- const mail = new MailArchiveGitHelperProxy ( notes , repo . workDir , github , { latestRevision : "HEAD~~" } , "master" ) ;
389+ const mail = new MailArchiveGitHelperProxy (
390+ config ,
391+ notes ,
392+ repo . workDir ,
393+ github ,
394+ { latestRevision : "HEAD~~" } ,
395+ "master" ,
396+ ) ;
369397
370398 const commitsResponse = getCommitsResponse ;
371399 const fail = false ;
@@ -453,7 +481,14 @@ This Pull Request contains some ipsum lorem.
453481 const notes = new GitNotes ( repo . workDir ) ;
454482 await notes . set ( mailMeta . messageID , mailMeta , true ) ;
455483
456- const mail = new MailArchiveGitHelperProxy ( notes , repo . workDir , github , { latestRevision : "HEAD~" } , "master" ) ;
484+ const mail = new MailArchiveGitHelperProxy (
485+ config ,
486+ notes ,
487+ repo . workDir ,
488+ github ,
489+ { latestRevision : "HEAD~" } ,
490+ "master" ,
491+ ) ;
457492
458493 const commitsResponse = getCommitsResponse ;
459494 const fail = true ;
@@ -530,7 +565,14 @@ This Pull Request contains some ipsum lorem.
530565 const notes = new GitNotes ( repo . workDir ) ;
531566 await notes . set ( mailMeta . messageID , mailMeta , true ) ;
532567
533- const mail = new MailArchiveGitHelperProxy ( notes , repo . workDir , github , { latestRevision : "HEAD~" } , "master" ) ;
568+ const mail = new MailArchiveGitHelperProxy (
569+ config ,
570+ notes ,
571+ repo . workDir ,
572+ github ,
573+ { latestRevision : "HEAD~" } ,
574+ "master" ,
575+ ) ;
534576
535577 const commitsResponse = getCommitsResponse ;
536578 commitsResponse . data [ 0 ] . sha = mailMeta . originalCommit ;
0 commit comments