@@ -60,9 +60,10 @@ describe('OAuthProvider', function() {
6060 } ) ;
6161
6262 it ( 'should not throw an error if `clientSecret` param is empty' , function ( ) {
63- var config = provider . configure ( _ . omit ( defaults , 'clientSecret' ) ) ;
64-
65- ( null === config . clientSecret ) . should . true ;
63+ try {
64+ provider . configure ( _ . omit ( defaults , 'clientSecret' ) ) ;
65+ should . not . fail ( ) ;
66+ } catch ( e ) { }
6667 } ) ;
6768
6869 it ( 'should throw an error if `grantPath` param is empty' , function ( ) {
@@ -77,19 +78,19 @@ describe('OAuthProvider', function() {
7778 } ) ;
7879
7980 it ( 'should remove trailing slash from `baseUrl`' , function ( ) {
80- var config = provider . configure ( _ . defaults ( {
81+ provider . configure ( _ . defaults ( {
8182 baseUrl : 'https://api.website.com/'
8283 } , defaults ) ) ;
8384
84- config . baseUrl . should . equal ( 'https://api.website.com' ) ;
85+ provider . defaultConfig . baseUrl . should . equal ( 'https://api.website.com' ) ;
8586 } ) ;
8687
8788 it ( 'should add facing slash from `grantPath`' , function ( ) {
88- var config = provider . configure ( _ . defaults ( {
89+ provider . configure ( _ . defaults ( {
8990 grantPath : 'oauth2/token'
9091 } , defaults ) ) ;
9192
92- config . grantPath . should . equal ( '/oauth2/token' ) ;
93+ provider . defaultConfig . grantPath . should . equal ( '/oauth2/token' ) ;
9394 } ) ;
9495
9596 it ( 'should throw an error if `revokePath` param is empty' , function ( ) {
@@ -104,11 +105,11 @@ describe('OAuthProvider', function() {
104105 } ) ;
105106
106107 it ( 'should add facing slash from `revokePath`' , function ( ) {
107- var config = provider . configure ( _ . defaults ( {
108+ provider . configure ( _ . defaults ( {
108109 revokePath : 'oauth2/revoke'
109110 } , defaults ) ) ;
110111
111- config . revokePath . should . equal ( '/oauth2/revoke' ) ;
112+ provider . defaultConfig . revokePath . should . equal ( '/oauth2/revoke' ) ;
112113 } ) ;
113114 } ) ;
114115
@@ -125,6 +126,11 @@ describe('OAuthProvider', function() {
125126 afterEach ( inject ( function ( OAuthToken ) {
126127 OAuthToken . removeToken ( ) ;
127128 } ) ) ;
129+ describe ( 'construtor' , function ( ) {
130+ it ( 'should set initialize config with data passed in configure' , inject ( function ( OAuth ) {
131+ OAuth . config . should . eql ( defaults ) ;
132+ } ) )
133+ } )
128134
129135 describe ( 'configure()' , function ( ) {
130136 it ( 'should throw an error if configuration is not an object' , inject ( function ( OAuth ) {
@@ -161,9 +167,11 @@ describe('OAuthProvider', function() {
161167 } ) ) ;
162168
163169 it ( 'should not throw an error if `clientSecret` param is empty' , inject ( function ( OAuth ) {
164- var config = OAuth . configure ( _ . omit ( defaults , 'clientSecret' ) ) ;
165-
166- ( null === config . clientSecret ) . should . true ;
170+ try {
171+ OAuth . configure ( _ . omit ( defaults , 'clientSecret' ) ) ;
172+
173+ should . not . fail ( ) ;
174+ } catch ( e ) { }
167175 } ) ) ;
168176
169177 it ( 'should throw an error if `grantPath` param is empty' , inject ( function ( OAuth ) {
@@ -178,19 +186,19 @@ describe('OAuthProvider', function() {
178186 } ) ) ;
179187
180188 it ( 'should remove trailing slash from `baseUrl`' , inject ( function ( OAuth ) {
181- var config = OAuth . configure ( _ . defaults ( {
189+ OAuth . configure ( _ . defaults ( {
182190 baseUrl : 'https://api.website.com/'
183191 } , defaults ) ) ;
184192
185- config . baseUrl . should . equal ( 'https://api.website.com' ) ;
193+ OAuth . config . baseUrl . should . equal ( 'https://api.website.com' ) ;
186194 } ) ) ;
187195
188196 it ( 'should add facing slash from `grantPath`' , inject ( function ( OAuth ) {
189- var config = OAuth . configure ( _ . defaults ( {
197+ OAuth . configure ( _ . defaults ( {
190198 grantPath : 'oauth2/token'
191199 } , defaults ) ) ;
192200
193- config . grantPath . should . equal ( '/oauth2/token' ) ;
201+ OAuth . config . grantPath . should . equal ( '/oauth2/token' ) ;
194202 } ) ) ;
195203
196204 it ( 'should throw an error if `revokePath` param is empty' , inject ( function ( OAuth ) {
@@ -205,11 +213,11 @@ describe('OAuthProvider', function() {
205213 } ) ) ;
206214
207215 it ( 'should add facing slash from `revokePath`' , inject ( function ( OAuth ) {
208- var config = OAuth . configure ( _ . defaults ( {
216+ OAuth . configure ( _ . defaults ( {
209217 revokePath : 'oauth2/revoke'
210218 } , defaults ) ) ;
211219
212- config . revokePath . should . equal ( '/oauth2/revoke' ) ;
220+ OAuth . config . revokePath . should . equal ( '/oauth2/revoke' ) ;
213221 } ) ) ;
214222 } ) ;
215223
0 commit comments