@@ -5,7 +5,10 @@ describe('format(credentials)', function () {
55 describe ( 'arguments' , function ( ) {
66 describe ( 'credentials' , function ( ) {
77 it ( 'should be required' , function ( ) {
8- assert . throws ( ( ) => ( format as any ) ( ) , / c r e d e n t i a l s i s r e q u i r e d / ) ;
8+ assert . throws (
9+ ( ) => ( format as any ) ( ) ,
10+ / " c r e d e n t i a l s " m u s t b e a n o b j e c t / ,
11+ ) ;
912 } ) ;
1013
1114 it ( 'should accept credentials' , function ( ) {
@@ -16,43 +19,49 @@ describe('format(credentials)', function () {
1619 it ( 'should reject null' , function ( ) {
1720 assert . throws (
1821 format . bind ( null , null as any ) ,
19- / c r e d e n t i a l s i s r e q u i r e d / ,
22+ / " c r e d e n t i a l s " m u s t b e a n o b j e c t / ,
2023 ) ;
2124 } ) ;
2225
2326 it ( 'should reject a number' , function ( ) {
24- assert . throws ( format . bind ( null , 42 as any ) , / c r e d e n t i a l s i s r e q u i r e d / ) ;
27+ assert . throws (
28+ format . bind ( null , 42 as any ) ,
29+ / " c r e d e n t i a l s " m u s t b e a n o b j e c t / ,
30+ ) ;
2531 } ) ;
2632
2733 it ( 'should reject a string' , function ( ) {
28- assert . throws ( format . bind ( null , '' as any ) , / c r e d e n t i a l s i s r e q u i r e d / ) ;
34+ assert . throws (
35+ format . bind ( null , '' as any ) ,
36+ / " c r e d e n t i a l s " m u s t b e a n o b j e c t / ,
37+ ) ;
2938 } ) ;
3039
3140 it ( 'should reject an object without name' , function ( ) {
3241 assert . throws (
3342 format . bind ( null , { pass : 'bar' } as any ) ,
34- / c r e d e n t i a l s i s r e q u i r e d t o h a v e n a m e a n d p a s s p r o p e r t i e s / ,
43+ / " c r e d e n t i a l s " m u s t h a v e s t r i n g p r o p e r t i e s " n a m e " a n d " p a s s " / ,
3544 ) ;
3645 } ) ;
3746
3847 it ( 'should reject an object without pass' , function ( ) {
3948 assert . throws (
4049 format . bind ( null , { name : 'foo' } as any ) ,
41- / c r e d e n t i a l s i s r e q u i r e d t o h a v e n a m e a n d p a s s p r o p e r t i e s / ,
50+ / " c r e d e n t i a l s " m u s t h a v e s t r i n g p r o p e r t i e s " n a m e " a n d " p a s s " / ,
4251 ) ;
4352 } ) ;
4453
4554 it ( 'should reject an object with non-string name' , function ( ) {
4655 assert . throws (
4756 format . bind ( null , { name : 42 , pass : 'bar' } as any ) ,
48- / c r e d e n t i a l s i s r e q u i r e d t o h a v e n a m e a n d p a s s p r o p e r t i e s / ,
57+ / " c r e d e n t i a l s " m u s t h a v e s t r i n g p r o p e r t i e s " n a m e " a n d " p a s s " / ,
4958 ) ;
5059 } ) ;
5160
5261 it ( 'should reject an object with non-string pass' , function ( ) {
5362 assert . throws (
5463 format . bind ( null , { name : 'foo' , pass : 42 } as any ) ,
55- / c r e d e n t i a l s i s r e q u i r e d t o h a v e n a m e a n d p a s s p r o p e r t i e s / ,
64+ / " c r e d e n t i a l s " m u s t h a v e s t r i n g p r o p e r t i e s " n a m e " a n d " p a s s " / ,
5665 ) ;
5766 } ) ;
5867
@@ -87,21 +96,21 @@ describe('format(credentials)', function () {
8796 } ) ;
8897
8998 describe ( 'with empty password' , function ( ) {
90- it ( 'should throw ' , function ( ) {
99+ it ( 'should return header ' , function ( ) {
91100 const header = format ( { name : 'foo' , pass : '' } ) ;
92101 assert . strictEqual ( header , 'Basic Zm9vOg==' ) ;
93102 } ) ;
94103 } ) ;
95104
96105 describe ( 'with empty userid' , function ( ) {
97- it ( 'should throw ' , function ( ) {
106+ it ( 'should return header ' , function ( ) {
98107 const header = format ( { name : '' , pass : 'pass' } ) ;
99108 assert . strictEqual ( header , 'Basic OnBhc3M=' ) ;
100109 } ) ;
101110 } ) ;
102111
103112 describe ( 'with empty userid and pass' , function ( ) {
104- it ( 'should throw ' , function ( ) {
113+ it ( 'should return header ' , function ( ) {
105114 const header = format ( { name : '' , pass : '' } ) ;
106115 assert . strictEqual ( header , 'Basic Og==' ) ;
107116 } ) ;
0 commit comments