@@ -243,12 +243,12 @@ describe('Service', function() {
243243 } ) ;
244244
245245 describe ( '#exchangeGrant_()' , function ( ) {
246- var witLowerCaseKeys_ = OAuth2 . witLowerCaseKeys_ ;
246+ var toLowerCaseKeys_ = OAuth2 . toLowerCaseKeys_ ;
247247
248248 it ( 'should not set auth header if the grant type is not client_credentials' ,
249249 function ( done ) {
250250 mocks . UrlFetchApp . resultFunction = function ( url , urlOptions ) {
251- assert . isUndefined ( witLowerCaseKeys_ ( urlOptions . headers ) . authorization ) ;
251+ assert . isUndefined ( toLowerCaseKeys_ ( urlOptions . headers ) . authorization ) ;
252252 done ( ) ;
253253 } ;
254254 var service = OAuth2 . createService ( 'test' )
@@ -260,7 +260,7 @@ describe('Service', function() {
260260 it ( 'should not set auth header if the client ID is not set' ,
261261 function ( done ) {
262262 mocks . UrlFetchApp . resultFunction = function ( url , urlOptions ) {
263- assert . isUndefined ( witLowerCaseKeys_ ( urlOptions . headers ) . authorization ) ;
263+ assert . isUndefined ( toLowerCaseKeys_ ( urlOptions . headers ) . authorization ) ;
264264 done ( ) ;
265265 } ;
266266 var service = OAuth2 . createService ( 'test' )
@@ -272,7 +272,7 @@ describe('Service', function() {
272272 it ( 'should not set auth header if the client secret is not set' ,
273273 function ( done ) {
274274 mocks . UrlFetchApp . resultFunction = function ( url , urlOptions ) {
275- assert . isUndefined ( witLowerCaseKeys_ ( urlOptions . headers ) . authorization ) ;
275+ assert . isUndefined ( toLowerCaseKeys_ ( urlOptions . headers ) . authorization ) ;
276276 done ( ) ;
277277 } ;
278278 var service = OAuth2 . createService ( 'test' )
@@ -285,7 +285,7 @@ describe('Service', function() {
285285 it ( 'should not set auth header if it is already set' ,
286286 function ( done ) {
287287 mocks . UrlFetchApp . resultFunction = function ( url , urlOptions ) {
288- assert . equal ( witLowerCaseKeys_ ( urlOptions . headers ) . authorization ,
288+ assert . equal ( toLowerCaseKeys_ ( urlOptions . headers ) . authorization ,
289289 'something' ) ;
290290 done ( ) ;
291291 } ;
@@ -304,7 +304,7 @@ describe('Service', function() {
304304 'the client ID and client secret are set and the authorization header' +
305305 'is not already set' , function ( done ) {
306306 mocks . UrlFetchApp . resultFunction = function ( url , urlOptions ) {
307- assert . equal ( witLowerCaseKeys_ ( urlOptions . headers ) . authorization ,
307+ assert . equal ( toLowerCaseKeys_ ( urlOptions . headers ) . authorization ,
308308 'Basic YWJjOmRlZg==' ) ;
309309 done ( ) ;
310310 } ;
@@ -336,38 +336,32 @@ describe('Utilities', function() {
336336 } ) ;
337337 } ) ;
338338
339- describe ( '#witLowerCaseKeys_()' , function ( ) {
340- var witLowerCaseKeys_ = OAuth2 . witLowerCaseKeys_ ;
341- var data = {
342- 'a' : true ,
343- 'A' : true ,
344- 'B' : true ,
345- 'Cc' : true ,
346- 'D2' : true ,
347- 'E!@#' : true
348- } ;
349- var lowerCaseData = witLowerCaseKeys_ ( data ) ;
350-
351- it ( 'should contain lower-case keys' , function ( ) {
352- assert . isTrue ( lowerCaseData [ 'a' ] ) ;
353- assert . isTrue ( lowerCaseData [ 'b' ] ) ;
354- assert . isTrue ( lowerCaseData [ 'cc' ] ) ;
355- assert . isTrue ( lowerCaseData [ 'd2' ] ) ;
356- assert . isTrue ( lowerCaseData [ 'e!@#' ] ) ;
357- } ) ;
358-
359- it ( 'should not contain upper-case keys' , function ( ) {
360- assert . isUndefined ( lowerCaseData [ 'A' ] ) ;
361- assert . isUndefined ( lowerCaseData [ 'B' ] ) ;
362- assert . isUndefined ( lowerCaseData [ 'Cc' ] ) ;
363- assert . isUndefined ( lowerCaseData [ 'D2' ] ) ;
364- assert . isUndefined ( lowerCaseData [ 'E!@#' ] ) ;
339+ describe ( '#toLowerCaseKeys_()' , function ( ) {
340+ var toLowerCaseKeys_ = OAuth2 . toLowerCaseKeys_ ;
341+
342+ it ( 'should contain only lower-case keys' , function ( ) {
343+ var data = {
344+ 'a' : true ,
345+ 'A' : true ,
346+ 'B' : true ,
347+ 'Cc' : true ,
348+ 'D2' : true ,
349+ 'E!@#' : true
350+ } ;
351+ var lowerCaseData = toLowerCaseKeys_ ( data ) ;
352+ assert . deepEqual ( lowerCaseData , {
353+ 'a' : true ,
354+ 'b' : true ,
355+ 'cc' : true ,
356+ 'd2' : true ,
357+ 'e!@#' : true
358+ } ) ;
365359 } ) ;
366360
367361 it ( 'should handle null, undefined, and empty objects' , function ( ) {
368- assert . isNull ( witLowerCaseKeys_ ( null ) ) ;
369- assert . isUndefined ( witLowerCaseKeys_ ( undefined ) ) ;
370- assert . isEmpty ( witLowerCaseKeys_ ( { } ) ) ;
362+ assert . isNull ( toLowerCaseKeys_ ( null ) ) ;
363+ assert . isUndefined ( toLowerCaseKeys_ ( undefined ) ) ;
364+ assert . isEmpty ( toLowerCaseKeys_ ( { } ) ) ;
371365 } ) ;
372366 } ) ;
373367} ) ;
0 commit comments