@@ -2,10 +2,8 @@ const core = require('@actions/core');
22const assert = require ( 'assert' ) ;
33const aws = require ( 'aws-sdk' ) ;
44const run = require ( './index.js' ) ;
5- const axios = require ( 'axios' ) ;
65
76jest . mock ( '@actions/core' ) ;
8- jest . mock ( "axios" ) ;
97
108const FAKE_ACCESS_KEY_ID = 'MY-AWS-ACCESS-KEY-ID' ;
119const FAKE_SECRET_ACCESS_KEY = 'MY-AWS-SECRET-ACCESS-KEY' ;
@@ -91,6 +89,12 @@ describe('Configure AWS Credentials', () => {
9189 . fn ( )
9290 . mockImplementation ( mockGetInput ( DEFAULT_INPUTS ) ) ;
9391
92+ core . getIDToken = jest
93+ . fn ( )
94+ . mockImplementation ( ( ) => {
95+ return "testtoken"
96+ } ) ;
97+
9498 mockStsCallerIdentity . mockReset ( ) ;
9599 mockStsCallerIdentity
96100 . mockReturnValueOnce ( {
@@ -571,7 +575,6 @@ describe('Configure AWS Credentials', () => {
571575 test ( 'only role arn and region provided to use GH OIDC Token' , async ( ) => {
572576 process . env . ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token' ;
573577 process . env . ACTIONS_ID_TOKEN_REQUEST_URL = 'https://www.example.com/token/endpoint' ;
574- axios . get . mockImplementation ( ( ) => Promise . resolve ( { data : { value : "testtoken" } } ) ) ;
575578 core . getInput = jest
576579 . fn ( )
577580 . mockImplementation ( mockGetInput ( { 'role-to-assume' : ROLE_ARN , 'aws-region' : FAKE_REGION } ) ) ;
@@ -592,7 +595,6 @@ describe('Configure AWS Credentials', () => {
592595 const CUSTOM_ROLE_DURATION = 1234 ;
593596 process . env . ACTIONS_ID_TOKEN_REQUEST_TOKEN = 'test-token' ;
594597 process . env . ACTIONS_ID_TOKEN_REQUEST_URL = 'https://www.example.com/token/endpoint' ;
595- axios . get . mockImplementation ( ( ) => Promise . resolve ( { data : { value : "testtoken" } } ) ) ;
596598 core . getInput = jest
597599 . fn ( )
598600 . mockImplementation ( mockGetInput ( { 'role-to-assume' : ROLE_ARN , 'aws-region' : FAKE_REGION , 'role-duration-seconds' : CUSTOM_ROLE_DURATION } ) ) ;
0 commit comments