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