11const openopsCommonMock = {
22 ...jest . requireActual ( '@openops/common' ) ,
3- getCredentialsListFromAuth : jest . fn ( ) ,
3+ getCredentialsForAccount : jest . fn ( ) ,
44 runAndWaitForQueryResult : jest . fn ( ) ,
55} ;
66
@@ -12,9 +12,9 @@ describe('runAthenaQueryAction tests', () => {
1212 beforeEach ( ( ) => {
1313 jest . clearAllMocks ( ) ;
1414
15- openopsCommonMock . getCredentialsListFromAuth . mockResolvedValue ( [
16- { someCreds : 'some creds' } ,
17- ] ) ;
15+ openopsCommonMock . getCredentialsForAccount . mockResolvedValue ( {
16+ someCreds : 'some creds' ,
17+ } ) ;
1818 } ) ;
1919
2020 const auth = {
@@ -76,7 +76,7 @@ describe('runAthenaQueryAction tests', () => {
7676 ...jest . requireActual ( '@openops/blocks-framework' ) ,
7777 auth : auth ,
7878 propsValue : {
79- accounts : { accounts : [ 'some-account-id' ] } ,
79+ accounts : { accounts : 'some-account-id' } ,
8080 query : 'some query' ,
8181 database : 'some database' ,
8282 outputBucket : 'some outputBucket' ,
@@ -87,12 +87,10 @@ describe('runAthenaQueryAction tests', () => {
8787 const result = ( await runAthenaQueryAction . run ( context ) ) as any ;
8888
8989 expect ( result ) . toEqual ( 'mockResult' ) ;
90- expect ( openopsCommonMock . getCredentialsListFromAuth ) . toHaveBeenCalledTimes (
91- 1 ,
92- ) ;
93- expect ( openopsCommonMock . getCredentialsListFromAuth ) . toHaveBeenCalledWith (
90+ expect ( openopsCommonMock . getCredentialsForAccount ) . toHaveBeenCalledTimes ( 1 ) ;
91+ expect ( openopsCommonMock . getCredentialsForAccount ) . toHaveBeenCalledWith (
9492 auth ,
95- [ 'some-account-id' ] ,
93+ 'some-account-id' ,
9694 ) ;
9795 } ) ;
9896
@@ -138,7 +136,6 @@ describe('runAthenaQueryAction tests', () => {
138136 ...jest . requireActual ( '@openops/blocks-framework' ) ,
139137 auth : auth ,
140138 propsValue : {
141- accounts : { accounts : [ 'some-account-id' ] } ,
142139 region : 'some region' ,
143140 query : 'some query' ,
144141 database : 'some database' ,
@@ -158,12 +155,10 @@ describe('runAthenaQueryAction tests', () => {
158155 'some database' ,
159156 'some outputBucket' ,
160157 ) ;
161- expect ( openopsCommonMock . getCredentialsListFromAuth ) . toHaveBeenCalledTimes (
162- 1 ,
163- ) ;
164- expect ( openopsCommonMock . getCredentialsListFromAuth ) . toHaveBeenCalledWith (
158+ expect ( openopsCommonMock . getCredentialsForAccount ) . toHaveBeenCalledTimes ( 1 ) ;
159+ expect ( openopsCommonMock . getCredentialsForAccount ) . toHaveBeenCalledWith (
165160 auth ,
166- [ 'some-account-id' ] ,
161+ undefined ,
167162 ) ;
168163 } ) ;
169164
0 commit comments