@@ -11,7 +11,6 @@ jest.mock('@octokit/auth-app', () => ({
11
11
const mockOctokit = {
12
12
checks : { get : jest . fn ( ) } ,
13
13
actions : {
14
- listWorkflowRunsForRepo : jest . fn ( ) ,
15
14
createRegistrationTokenForOrg : jest . fn ( ) ,
16
15
createRegistrationTokenForRepo : jest . fn ( ) ,
17
16
} ,
@@ -40,9 +39,9 @@ describe('scaleUp', () => {
40
39
process . env . ENVIRONMENT = 'unit-test-environment' ;
41
40
42
41
jest . clearAllMocks ( ) ;
43
- mockOctokit . actions . listWorkflowRunsForRepo . mockImplementation ( ( ) => ( {
42
+ mockOctokit . checks . get . mockImplementation ( ( ) => ( {
44
43
data : {
45
- total_count : 1 ,
44
+ status : 'queued' ,
46
45
} ,
47
46
} ) ) ;
48
47
const mockTokenReturnValue = {
@@ -70,16 +69,16 @@ describe('scaleUp', () => {
70
69
71
70
it ( 'checks queued workflows' , async ( ) => {
72
71
await scaleUp ( 'aws:sqs' , TEST_DATA ) ;
73
- expect ( mockOctokit . actions . listWorkflowRunsForRepo ) . toBeCalledWith ( {
72
+ expect ( mockOctokit . checks . get ) . toBeCalledWith ( {
73
+ check_run_id : TEST_DATA . id ,
74
74
owner : TEST_DATA . repositoryOwner ,
75
75
repo : TEST_DATA . repositoryName ,
76
- status : 'queued' ,
77
76
} ) ;
78
77
} ) ;
79
78
80
79
it ( 'does not list runners when no workflows are queued' , async ( ) => {
81
- mockOctokit . actions . listWorkflowRunsForRepo . mockImplementation ( ( ) => ( {
82
- data : { total_count : 0 , runners : [ ] } ,
80
+ mockOctokit . checks . get . mockImplementation ( ( ) => ( {
81
+ data : { status : 'completed' } ,
83
82
} ) ) ;
84
83
await scaleUp ( 'aws:sqs' , TEST_DATA ) ;
85
84
expect ( listRunners ) . not . toBeCalled ( ) ;
0 commit comments