@@ -2,8 +2,10 @@ const core = require('@actions/core');
2
2
const assert = require ( 'assert' ) ;
3
3
const aws = require ( 'aws-sdk' ) ;
4
4
const run = require ( './index.js' ) ;
5
+ const axios = require ( 'axios' ) ;
5
6
6
7
jest . mock ( '@actions/core' ) ;
8
+ jest . mock ( "axios" ) ;
7
9
8
10
const FAKE_ACCESS_KEY_ID = 'MY-AWS-ACCESS-KEY-ID' ;
9
11
const FAKE_SECRET_ACCESS_KEY = 'MY-AWS-SECRET-ACCESS-KEY' ;
@@ -89,12 +91,6 @@ describe('Configure AWS Credentials', () => {
89
91
. fn ( )
90
92
. mockImplementation ( mockGetInput ( DEFAULT_INPUTS ) ) ;
91
93
92
- core . getIDToken = jest
93
- . fn ( )
94
- . mockImplementation ( ( ) => {
95
- return "testtoken"
96
- } ) ;
97
-
98
94
mockStsCallerIdentity . mockReset ( ) ;
99
95
mockStsCallerIdentity
100
96
. mockReturnValueOnce ( {
@@ -575,6 +571,7 @@ describe('Configure AWS Credentials', () => {
575
571
test ( 'only role arn and region provided to use GH OIDC Token' , async ( ) => {
576
572
process . env . ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token' ;
577
573
process . env . ACTIONS_ID_TOKEN_REQUEST_URL = 'https://www.example.com/token/endpoint' ;
574
+ axios . get . mockImplementation ( ( ) => Promise . resolve ( { data : { value : "testtoken" } } ) ) ;
578
575
core . getInput = jest
579
576
. fn ( )
580
577
. mockImplementation ( mockGetInput ( { 'role-to-assume' : ROLE_ARN , 'aws-region' : FAKE_REGION } ) ) ;
@@ -595,6 +592,7 @@ describe('Configure AWS Credentials', () => {
595
592
const CUSTOM_ROLE_DURATION = 1234 ;
596
593
process . env . ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token' ;
597
594
process . env . ACTIONS_ID_TOKEN_REQUEST_URL = 'https://www.example.com/token/endpoint' ;
595
+ axios . get . mockImplementation ( ( ) => Promise . resolve ( { data : { value : "testtoken" } } ) ) ;
598
596
core . getInput = jest
599
597
. fn ( )
600
598
. mockImplementation ( mockGetInput ( { 'role-to-assume' : ROLE_ARN , 'aws-region' : FAKE_REGION , 'role-duration-seconds' : CUSTOM_ROLE_DURATION } ) ) ;
0 commit comments