@@ -32,22 +32,28 @@ describe("EndpointsConfig", () => {
3232 it ( "returns output of urlParser if endpoint is of type string" , async ( ) => {
3333 const endpoint = "endpoint" ;
3434 urlParser . mockReturnValueOnce ( mockEndpoint ) ;
35- const endpointOutput = await resolveEndpointsConfig ( { ...input , endpoint } ) . endpoint ( ) ;
35+ const { endpoint : endpointProvider , isCustomEndpoint } = resolveEndpointsConfig ( { ...input , endpoint } ) ;
36+ expect ( isCustomEndpoint ) . toBe ( true ) ;
37+ const endpointOutput = await endpointProvider ( ) ;
3638 expect ( endpointOutput ) . toStrictEqual ( mockEndpoint ) ;
3739 expect ( urlParser ) . toHaveBeenCalledTimes ( 1 ) ;
3840 expect ( urlParser ) . toHaveBeenCalledWith ( endpoint ) ;
3941 } ) ;
4042
4143 it ( "returns promisified endpoint if it's of type object" , async ( ) => {
4244 const endpoint = mockEndpoint ;
43- const endpointOutput = await resolveEndpointsConfig ( { ...input , endpoint } ) . endpoint ( ) ;
45+ const { endpoint : endpointProvider , isCustomEndpoint } = resolveEndpointsConfig ( { ...input , endpoint } ) ;
46+ expect ( isCustomEndpoint ) . toBe ( true ) ;
47+ const endpointOutput = await endpointProvider ( ) ;
4448 expect ( endpointOutput ) . toStrictEqual ( endpoint ) ;
4549 expect ( urlParser ) . not . toHaveBeenCalled ( ) ;
4650 } ) ;
4751
4852 it ( "returns endpoint if it's already Provider<Endpoint>" , async ( ) => {
4953 const endpoint = ( ) => Promise . resolve ( mockEndpoint ) ;
50- const endpointOutput = await resolveEndpointsConfig ( { ...input , endpoint } ) . endpoint ( ) ;
54+ const { endpoint : endpointProvider , isCustomEndpoint } = resolveEndpointsConfig ( { ...input , endpoint } ) ;
55+ expect ( isCustomEndpoint ) . toBe ( true ) ;
56+ const endpointOutput = await endpointProvider ( ) ;
5157 expect ( endpointOutput ) . toStrictEqual ( mockEndpoint ) ;
5258 expect ( urlParser ) . not . toHaveBeenCalled ( ) ;
5359 } ) ;
@@ -58,6 +64,11 @@ describe("EndpointsConfig", () => {
5864 const mockHostname = "mockHostname" ;
5965 const mockEndpoint : Endpoint = { protocol : "protocol" , hostname : "hostname" , path : "path" } ;
6066
67+ it ( "isCustomEndpoint should be false" , ( ) => {
68+ const { isCustomEndpoint } = resolveEndpointsConfig ( { ...input } ) ;
69+ expect ( isCustomEndpoint ) . toBe ( false ) ;
70+ } ) ;
71+
6172 describe ( "returns endpoint" , ( ) => {
6273 beforeEach ( ( ) => {
6374 region . mockResolvedValueOnce ( mockRegion ) ;
0 commit comments