@@ -2,7 +2,7 @@ import { beforeEach, describe, it, mock } from 'node:test';
2
2
import assert from 'assert' ;
3
3
import { NoSuchKey , S3 , S3ServiceException } from '@aws-sdk/client-s3' ;
4
4
5
- import { getAmplifyClientsConfiguration } from './get_amplify_clients_configuration.js' ;
5
+ import { internalGetAmplifyClientConfiguration } from './get_amplify_clients_configuration.js' ;
6
6
7
7
const validEnv = {
8
8
AMPLIFY_DATA_MODEL_INTROSPECTION_SCHEMA_BUCKET_NAME :
@@ -18,7 +18,7 @@ const validEnv = {
18
18
19
19
let mockS3Client : S3 ;
20
20
21
- void describe ( 'getAmplifyClientsConfiguration ' , ( ) => {
21
+ void describe ( 'internalGetAmplifyClientConfiguration ' , ( ) => {
22
22
beforeEach ( ( ) => {
23
23
mockS3Client = new S3 ( ) ;
24
24
} ) ;
@@ -27,7 +27,7 @@ void describe('getAmplifyClientsConfiguration', () => {
27
27
void it ( `returns empty config objects when ${ envFieldToExclude } is not included` , async ( ) => {
28
28
const env = { ...validEnv } as Record < string , string > ;
29
29
delete env [ envFieldToExclude ] ;
30
- assert . deepEqual ( await getAmplifyClientsConfiguration ( env ) , {
30
+ assert . deepEqual ( await internalGetAmplifyClientConfiguration ( env ) , {
31
31
resourceConfig : { } ,
32
32
libraryOptions : { } ,
33
33
} ) ;
@@ -36,7 +36,7 @@ void describe('getAmplifyClientsConfiguration', () => {
36
36
void it ( `returns empty config objects when ${ envFieldToExclude } is not a string` , async ( ) => {
37
37
const env = { ...validEnv } as Record < string , unknown > ;
38
38
env [ envFieldToExclude ] = 123 ;
39
- assert . deepEqual ( await getAmplifyClientsConfiguration ( env ) , {
39
+ assert . deepEqual ( await internalGetAmplifyClientConfiguration ( env ) , {
40
40
resourceConfig : { } ,
41
41
libraryOptions : { } ,
42
42
} ) ;
@@ -50,7 +50,8 @@ void describe('getAmplifyClientsConfiguration', () => {
50
50
mock . method ( mockS3Client , 'send' , s3ClientSendMock ) ;
51
51
52
52
await assert . rejects (
53
- async ( ) => await getAmplifyClientsConfiguration ( validEnv , mockS3Client ) ,
53
+ async ( ) =>
54
+ await internalGetAmplifyClientConfiguration ( validEnv , mockS3Client ) ,
54
55
new Error (
55
56
'Error retrieving the schema from S3. Please confirm that your project has a `defineData` included in the `defineBackend` definition.'
56
57
)
@@ -69,7 +70,8 @@ void describe('getAmplifyClientsConfiguration', () => {
69
70
mock . method ( mockS3Client , 'send' , s3ClientSendMock ) ;
70
71
71
72
await assert . rejects (
72
- async ( ) => await getAmplifyClientsConfiguration ( validEnv , mockS3Client ) ,
73
+ async ( ) =>
74
+ await internalGetAmplifyClientConfiguration ( validEnv , mockS3Client ) ,
73
75
new Error (
74
76
'Error retrieving the schema from S3. You may need to grant this function authorization on the schema. TEST_ERROR: TEST_MESSAGE.'
75
77
)
@@ -83,7 +85,8 @@ void describe('getAmplifyClientsConfiguration', () => {
83
85
mock . method ( mockS3Client , 'send' , s3ClientSendMock ) ;
84
86
85
87
await assert . rejects (
86
- async ( ) => await getAmplifyClientsConfiguration ( validEnv , mockS3Client ) ,
88
+ async ( ) =>
89
+ await internalGetAmplifyClientConfiguration ( validEnv , mockS3Client ) ,
87
90
new Error ( 'Test Error' )
88
91
) ;
89
92
} ) ;
@@ -99,7 +102,7 @@ void describe('getAmplifyClientsConfiguration', () => {
99
102
mock . method ( mockS3Client , 'send' , s3ClientSendMock ) ;
100
103
101
104
const { resourceConfig, libraryOptions } =
102
- await getAmplifyClientsConfiguration ( validEnv , mockS3Client ) ;
105
+ await internalGetAmplifyClientConfiguration ( validEnv , mockS3Client ) ;
103
106
104
107
assert . deepEqual (
105
108
await libraryOptions . Auth . credentialsProvider . getCredentialsAndIdentityId ?.( ) ,
0 commit comments