@@ -4,6 +4,12 @@ import {context} from '@actions/github';
44import { GoogleGenAI } from '@google/genai' ;
55import { IssueLabeling } from './issue-labeling.js' ;
66
7+ class TestableIssueLabeling extends IssueLabeling {
8+ public constructor ( git : Octokit , coreService : typeof core ) {
9+ super ( git , coreService ) ;
10+ }
11+ }
12+
713describe ( 'IssueLabeling' , ( ) => {
814 let mockGit : {
915 paginate : jasmine . Spy ;
@@ -37,10 +43,7 @@ describe('IssueLabeling', () => {
3743 } ,
3844 } ) ,
3945 ) ;
40- mockGit . paginate . and . callFake ( ( fn : any , opts : any ) => {
41- // Return value matching listLabelsForRepo signature
42- return Promise . resolve ( [ { name : 'area: core' } , { name : 'area: router' } , { name : 'bug' } ] ) ;
43- } ) ;
46+ mockGit . paginate . and . resolveTo ( [ { name : 'area: core' } , { name : 'area: router' } , { name : 'bug' } ] ) ;
4447
4548 mockAI = {
4649 models : jasmine . createSpyObj ( 'models' , [ 'generateContent' ] ) ,
@@ -60,9 +63,10 @@ describe('IssueLabeling', () => {
6063 mockCore . debug . and . callFake ( console . debug ) ;
6164 mockCore . setFailed . and . callFake ( console . error ) ;
6265
66+
6367 // We must cast the mock to Octokit because the mock only implements the subset used by the class.
6468 // This is standard for mocking large interfaces like Octokit.
65- issueLabeling = new IssueLabeling ( mockGit as unknown as Octokit , mockCore ) ;
69+ issueLabeling = new TestableIssueLabeling ( mockGit as unknown as Octokit , mockCore ) ;
6670
6771 spyOn ( issueLabeling , 'getGenerativeAI' ) . and . returnValue ( mockAI ) ;
6872 } ) ;
0 commit comments