@@ -32,6 +32,7 @@ describe('strategies', function () {
32
32
beforeEach ( function ( ) {
33
33
this . student = new Student ( 'tom' , 10 , 'M' ) ;
34
34
this . anonymous = new AnonStudent ( 'mary' , 9 , 'F' ) ;
35
+ this . longNameStudent = new Student ( 'the_long_name_man' , 18 , 'M' ) ;
35
36
} ) ;
36
37
37
38
it ( 'always' , function ( ) {
@@ -182,7 +183,19 @@ describe('strategies', function () {
182
183
return true ;
183
184
} )
184
185
} ;
185
- assert . equal ( stringify ( this . student , null , handlers ) , 'Student{name:"to..(snip),age:10,gender:"M"}' ) ;
186
+ assert . equal ( stringify ( this . longNameStudent , null , handlers ) , 'Student{name:"th..(snip),age:18,gender:"M"}' ) ;
187
+ } ) ;
188
+
189
+ it ( 'do not truncate if string length is short enough' , function ( ) {
190
+ var handlers = {
191
+ 'Student' : s . object ( function ( kvp ) {
192
+ if ( kvp . key === 'name' ) {
193
+ return 3 ;
194
+ }
195
+ return true ;
196
+ } )
197
+ } ;
198
+ assert . equal ( stringify ( this . student , null , handlers ) , 'Student{name:"tom",age:10,gender:"M"}' ) ;
186
199
} ) ;
187
200
188
201
it ( 'per-property truncate bare handler' , function ( ) {
@@ -194,7 +207,7 @@ describe('strategies', function () {
194
207
return true ;
195
208
} )
196
209
} ;
197
- assert . equal ( stringify ( this . student , null , handlers ) , 'Student{name:"to ..(snip),age:10 ,gender:"M"}' ) ;
210
+ assert . equal ( stringify ( this . longNameStudent , null , handlers ) , 'Student{name:"th ..(snip),age:18 ,gender:"M"}' ) ;
198
211
} ) ;
199
212
200
213
0 commit comments