@@ -2,8 +2,10 @@ const core = require('@actions/core');
22const assert = require ( 'assert' ) ;
33const aws = require ( 'aws-sdk' ) ;
44const run = require ( './index.js' ) ;
5+ const axios = require ( 'axios' ) ;
56
67jest . mock ( '@actions/core' ) ;
8+ jest . mock ( "axios" ) ;
79
810const FAKE_ACCESS_KEY_ID = 'MY-AWS-ACCESS-KEY-ID' ;
911const FAKE_SECRET_ACCESS_KEY = 'MY-AWS-SECRET-ACCESS-KEY' ;
@@ -89,12 +91,6 @@ describe('Configure AWS Credentials', () => {
8991 . fn ( )
9092 . mockImplementation ( mockGetInput ( DEFAULT_INPUTS ) ) ;
9193
92- core . getIDToken = jest
93- . fn ( )
94- . mockImplementation ( ( ) => {
95- return "testtoken"
96- } ) ;
97-
9894 mockStsCallerIdentity . mockReset ( ) ;
9995 mockStsCallerIdentity
10096 . mockReturnValueOnce ( {
@@ -575,6 +571,7 @@ describe('Configure AWS Credentials', () => {
575571 test ( 'only role arn and region provided to use GH OIDC Token' , async ( ) => {
576572 process . env . ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token' ;
577573 process . env . ACTIONS_ID_TOKEN_REQUEST_URL = 'https://www.example.com/token/endpoint' ;
574+ axios . get . mockImplementation ( ( ) => Promise . resolve ( { data : { value : "testtoken" } } ) ) ;
578575 core . getInput = jest
579576 . fn ( )
580577 . mockImplementation ( mockGetInput ( { 'role-to-assume' : ROLE_ARN , 'aws-region' : FAKE_REGION } ) ) ;
@@ -595,6 +592,7 @@ describe('Configure AWS Credentials', () => {
595592 const CUSTOM_ROLE_DURATION = 1234 ;
596593 process . env . ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token' ;
597594 process . env . ACTIONS_ID_TOKEN_REQUEST_URL = 'https://www.example.com/token/endpoint' ;
595+ axios . get . mockImplementation ( ( ) => Promise . resolve ( { data : { value : "testtoken" } } ) ) ;
598596 core . getInput = jest
599597 . fn ( )
600598 . mockImplementation ( mockGetInput ( { 'role-to-assume' : ROLE_ARN , 'aws-region' : FAKE_REGION , 'role-duration-seconds' : CUSTOM_ROLE_DURATION } ) ) ;
0 commit comments