1- import { afterEach , beforeEach , describe , expect , it , vi } from 'vitest ' ;
1+ import * as core from '@actions/core ' ;
22import {
33 AssumeRoleCommand ,
44 AssumeRoleWithWebIdentityCommand ,
55 GetCallerIdentityCommand ,
66 STSClient ,
77} from '@aws-sdk/client-sts' ;
8- import { fs , vol } from 'memfs' ;
9- import * as core from '@actions/core' ;
10- import mocks from './mockinputs.test' ;
118import { mockClient } from 'aws-sdk-client-mock' ;
12- import { run } from '../src/index' ;
9+ import { fs , vol } from 'memfs' ;
10+ import { beforeEach , describe , expect , it , vi } from 'vitest' ;
1311import { CredentialsClient } from '../src/CredentialsClient' ;
14- import { before } from 'node:test' ;
12+ import { run } from '../src/index' ;
13+ import mocks from './mockinputs.test' ;
1514
1615const mockedSTSClient = mockClient ( STSClient ) ;
1716
@@ -300,19 +299,19 @@ describe('Configure AWS Credentials', {}, () => {
300299 await run ( ) ;
301300 expect ( core . setFailed ) . toHaveBeenCalled ( ) ;
302301 } ) ;
303- it ( ' gets new creds if told to reuse existing but they\ 're invalid' , { } , async ( ) => {
302+ it ( " gets new creds if told to reuse existing but they're invalid" , { } , async ( ) => {
304303 vi . spyOn ( core , 'getInput' ) . mockImplementation ( mocks . getInput ( mocks . USE_EXISTING_CREDENTIALS_INPUTS ) ) ;
305304 mockedSTSClient . on ( GetCallerIdentityCommand ) . rejects ( ) ;
306305 await run ( ) ;
307- expect ( core . notice ) . toHaveBeenCalledWith ( 'No valid credentials exist. Running as normal.' )
306+ expect ( core . notice ) . toHaveBeenCalledWith ( 'No valid credentials exist. Running as normal.' ) ;
308307 } ) ;
309- it ( ' doesn\ 't get new creds if there are already valid ones and we said use them' , { } , async ( ) => {
308+ it ( " doesn't get new creds if there are already valid ones and we said use them" , { } , async ( ) => {
310309 vi . spyOn ( core , 'getInput' ) . mockImplementation ( mocks . getInput ( mocks . USE_EXISTING_CREDENTIALS_INPUTS ) ) ;
311310 mockedSTSClient . on ( GetCallerIdentityCommand ) . resolves ( mocks . outputs . GET_CALLER_IDENTITY ) ;
312311 await run ( ) ;
313312 expect ( core . setFailed ) . not . toHaveBeenCalled ( ) ;
314- } )
315- it ( ' doesn\ 't export credentials as environment variables if told not to' , { } , async ( ) => {
313+ } ) ;
314+ it ( " doesn't export credentials as environment variables if told not to" , { } , async ( ) => {
316315 mockedSTSClient . on ( AssumeRoleWithWebIdentityCommand ) . resolvesOnce ( mocks . outputs . STS_CREDENTIALS ) ;
317316 vi . spyOn ( core , 'getInput' ) . mockImplementation ( mocks . getInput ( mocks . NO_ENV_CREDS_INPUTS ) ) ;
318317 vi . spyOn ( core , 'getIDToken' ) . mockResolvedValue ( 'testoidctoken' ) ;
@@ -321,7 +320,7 @@ describe('Configure AWS Credentials', {}, () => {
321320 expect ( core . setSecret ) . toHaveBeenCalledTimes ( 3 ) ;
322321 expect ( core . exportVariable ) . toHaveBeenCalledTimes ( 0 ) ;
323322 expect ( core . setFailed ) . not . toHaveBeenCalled ( ) ;
324- } )
323+ } ) ;
325324 it ( 'can export creds as step outputs without exporting as env variables' , { } , async ( ) => {
326325 mockedSTSClient . on ( AssumeRoleWithWebIdentityCommand ) . resolvesOnce ( mocks . outputs . STS_CREDENTIALS ) ;
327326 vi . spyOn ( core , 'getInput' ) . mockImplementation ( mocks . getInput ( mocks . STEP_BUT_NO_ENV_INPUTS ) ) ;
@@ -332,6 +331,6 @@ describe('Configure AWS Credentials', {}, () => {
332331 expect ( core . exportVariable ) . toHaveBeenCalledTimes ( 0 ) ;
333332 expect ( core . setOutput ) . toHaveBeenCalledTimes ( 4 ) ;
334333 expect ( core . setFailed ) . not . toHaveBeenCalled ( ) ;
335- } )
334+ } ) ;
336335 } ) ;
337336} ) ;
0 commit comments