@@ -33,7 +33,7 @@ describe('OAuthClientCredentialsClient', () => {
3333 fakeAuthorizeResponseBody ,
3434 fakeFormData
3535 ) ;
36- ( < any > sut ) . _fetch . and . returnValues (
36+ ( sut as any ) . _fetch . and . returnValues (
3737 Promise . resolve ( fakeAuthorizeResponseBody ) ,
3838 Promise . resolve ( fakeFetchResponseBody )
3939 ) ;
@@ -45,7 +45,7 @@ describe('OAuthClientCredentialsClient', () => {
4545 beforeEach ( async ( ) => result = await sut . login ( ) ) ;
4646
4747 it ( 'should call fetch with correct url' , ( ) => {
48- expect ( ( < any > sut ) . _fetch ) . toHaveBeenCalledWith (
48+ expect ( ( sut as any ) . _fetch ) . toHaveBeenCalledWith (
4949 `${ host } /oauth2/authorize` ,
5050 jasmine . anything ( )
5151 ) ;
@@ -56,7 +56,7 @@ describe('OAuthClientCredentialsClient', () => {
5656 expect ( fakeFormData . append ) . toHaveBeenCalledWith ( 'client_id' , clientId ) ;
5757 expect ( fakeFormData . append ) . toHaveBeenCalledWith ( 'client_secret' , clientSecret ) ;
5858 expect ( fakeFormData . append ) . toHaveBeenCalledWith ( 'scope' , 'restricted' ) ;
59- expect ( ( < any > sut ) . _fetch ) . toHaveBeenCalledWith (
59+ expect ( ( sut as any ) . _fetch ) . toHaveBeenCalledWith (
6060 jasmine . anything ( ) ,
6161 jasmine . objectContaining ( {
6262 method : 'POST' ,
@@ -104,14 +104,14 @@ describe('OAuthClientCredentialsClient', () => {
104104 } ) ;
105105
106106 it ( 'should call fetch with correct url' , ( ) => {
107- expect ( ( < any > sut ) . _fetch ) . toHaveBeenCalledWith (
107+ expect ( ( sut as any ) . _fetch ) . toHaveBeenCalledWith (
108108 `${ host } ${ route } ` ,
109109 jasmine . anything ( )
110110 ) ;
111111 } ) ;
112112
113113 it ( 'should call fetch with init containing Authorization header' , ( ) => {
114- const mostRecentCallArgs = ( < any > sut ) . _fetch . calls . mostRecent ( ) . args ;
114+ const mostRecentCallArgs = ( sut as any ) . _fetch . calls . mostRecent ( ) . args ;
115115 const headers = mostRecentCallArgs [ 1 ] . headers ;
116116 expect ( headers ) . toEqual ( jasmine . objectContaining ( {
117117 ...headers ,
@@ -120,11 +120,11 @@ describe('OAuthClientCredentialsClient', () => {
120120 } ) ;
121121
122122 it ( 'should call fetch with new init if init is not provided' , async ( ) => {
123- ( < any > sut ) . _fetch . and . returnValue ( Promise . resolve ( fakeAuthorizeResponseBody ) ) ;
123+ ( sut as any ) . _fetch . and . returnValue ( Promise . resolve ( fakeAuthorizeResponseBody ) ) ;
124124
125125 await sut . fetch ( route ) ;
126126
127- const mostRecentCallArgs = ( < any > sut ) . _fetch . calls . mostRecent ( ) . args ;
127+ const mostRecentCallArgs = ( sut as any ) . _fetch . calls . mostRecent ( ) . args ;
128128 const headers = mostRecentCallArgs [ 1 ] . headers ;
129129 expect ( headers ) . toEqual ( jasmine . objectContaining ( {
130130 Authorization : `${ fakeAuthorizeResult . token_type } ${ fakeAuthorizeResult . access_token } `
@@ -139,7 +139,7 @@ describe('OAuthClientCredentialsClient', () => {
139139
140140 describe ( 'error' , ( ) => {
141141 it ( 'should throw error with useful message if fetch returns 401' , async ( ) => {
142- ( < any > sut ) . _fetch . and . resolveTo ( createFakeResponseBody ( 401 ) ) ;
142+ ( sut as any ) . _fetch . and . resolveTo ( createFakeResponseBody ( 401 ) ) ;
143143
144144 await expectAsync ( sut . fetch ( route ) ) . toBeRejectedWithError (
145145 Error ,
@@ -158,9 +158,9 @@ function createFakeOAuthClientCredentialsClient(
158158 formData
159159) : OAuthClientCredentialsClient {
160160 const client = new OAuthClientCredentialsClient ( clientId , clientSecret , host ) ;
161- ( < any > client ) . _fetch = jasmine . createSpy ( ) ;
162- ( < any > client ) . _fetch . and . returnValue ( responseBody ) ;
163- ( < any > client ) . _createFormData = ( ) => formData ;
161+ ( client as any ) . _fetch = jasmine . createSpy ( ) ;
162+ ( client as any ) . _fetch . and . returnValue ( responseBody ) ;
163+ ( client as any ) . _createFormData = ( ) => formData ;
164164 return client ;
165165}
166166
0 commit comments