1
1
var expect = chai . expect
2
2
3
- describe ( "#chunk" , function ( ) {
4
- it ( "should break up an array into subarrays" , function ( ) {
5
- expect ( chunk ( [ 'a' , 'b' , 'c' , 'd' ] , 2 ) ) . to . deep . equal ( [ [ 'a' , 'b' ] , [ 'c' , 'd' ] ] )
6
- } ) ;
7
- it ( "should leave remaining chunks as subarrays" , function ( ) {
8
- expect ( chunk ( [ 'a' , 'b' , 'c' , 'd' ] , 3 ) ) . to . deep . equal ( [ [ 'a' , 'b' , 'c' ] , [ 'd' ] ] )
9
- } ) ;
10
- it ( "returns an array of arrays if the second parameter is greater or equal to the length" , function ( ) {
11
- expect ( chunk ( [ 'a' , 'b' , 'c' , 'd' ] , 10 ) ) . to . deep . equal ( [ [ 'a' , 'b' , 'c' , 'd' ] ] )
12
- } ) ;
13
- } ) ;
14
-
15
3
describe ( "#drop" , function ( ) {
16
4
it ( "should remove the first element of an array when no second parameter is passed" , function ( ) {
17
5
expect ( drop ( [ 1 , 2 , 3 ] ) ) . to . deep . equal ( [ 2 , 3 ] )
@@ -75,7 +63,7 @@ describe("#takeRight", function(){
75
63
expect ( takeRight ( [ 1 , 2 , 3 ] , 2 ) ) . to . deep . equal ( [ 2 , 3 ] )
76
64
} ) ;
77
65
it ( "copies the entire array if the second parameter is greater or equal to the length of the array" , function ( ) {
78
- expect ( takeRight ( [ 1 , 2 , 3 ] , 5 ) ) . to . deep . equal ( [ 1 , 2 ] )
66
+ expect ( takeRight ( [ 1 , 2 , 3 ] , 5 ) ) . to . deep . equal ( [ 1 , 2 , 3 ] )
79
67
} ) ;
80
68
it ( "returns an empty array if the second parameter is 0" , function ( ) {
81
69
expect ( takeRight ( [ 1 , 2 , 3 ] , 0 ) ) . to . deep . equal ( [ ] )
@@ -126,23 +114,7 @@ describe("#zipObject", function(){
126
114
expect ( zipObject ( [ 'a' , 'b' ] , [ 1 , 2 ] ) ) . to . deep . equal ( { 'a' : 1 , 'b' : 2 } )
127
115
} ) ;
128
116
it ( "should create keys and values if a value in the first array is specified" , function ( ) {
129
- expect ( zipObject ( [ 'a' , 'b' , 'c' , 'd' ] , [ 1 , 2 , 3 ] ) ) . to . deep . equal ( { a : 1 , b : 2 , c : 3 , d : 10 } )
130
- } ) ;
131
- } ) ;
132
-
133
- describe ( "#every" , function ( ) {
134
- it ( "should" , function ( ) {
135
- expect ( every ( [ true , 1 , null , 'yes' ] , Boolean ) ) . to . equal ( false )
136
-
137
- var users = [
138
- { 'user' : 'barney' , 'age' : 36 , 'active' : false } ,
139
- { 'user' : 'fred' , 'age' : 40 , 'active' : false }
140
- ] ;
141
-
142
- expect ( every ( users , { 'user' : 'barney' , 'active' : false } ) ) . to . equal ( false )
143
-
144
- expect ( every ( users , [ 'active' , false ] ) ) . to . equal ( true )
145
- expect ( every ( users , 'active' ) ) . to . equal ( false )
117
+ expect ( zipObject ( [ 'a' , 'b' , 'c' , 'd' ] , [ 1 , 2 , 3 ] ) ) . to . deep . equal ( { a : 1 , b : 2 , c : 3 , d : undefined } )
146
118
} ) ;
147
119
} ) ;
148
120
@@ -264,15 +236,15 @@ describe("#omitBy", function(){
264
236
} ) ;
265
237
} ) ;
266
238
267
- describe ( "#pad " , function ( ) {
268
- it ( "should pad with whitespace if no second parameter is passed in" , function ( ) {
269
- expect ( pad ( 'abc' , 8 ) ) . to . equal ( ' abc ' )
239
+ describe ( "#padEnd " , function ( ) {
240
+ it ( "should pad with whitespace if no third parameter is passed in" , function ( ) {
241
+ expect ( padEnd ( 'abc' , 6 ) ) . to . equal ( 'abc ' )
270
242
} ) ;
271
243
it ( "should pad both directions evenly" , function ( ) {
272
- expect ( pad ( 'abc' , 8 , '_-' ) ) . to . equal ( '_- abc_-_' )
244
+ expect ( padEnd ( 'abc' , 6 , '_-' ) ) . to . equal ( 'abc_-_' )
273
245
} ) ;
274
246
it ( "should not pad with anything if the length is less than or equal" , function ( ) {
275
- expect ( pad ( 'abc' , 3 ) ) . to . equal ( 'abc' )
247
+ expect ( padEnd ( 'abc' , 3 ) ) . to . equal ( 'abc' )
276
248
} ) ;
277
249
} ) ;
278
250
@@ -303,4 +275,4 @@ describe("#flattenDeep", function(){
303
275
it ( "should flatten a nested array completely" , function ( ) {
304
276
expect ( flattenDeep ( [ 1 , [ 2 , [ 3 , [ 4 ] ] , 5 ] ] ) ) . to . deep . equal ( [ 1 , 2 , 3 , 4 , 5 ] )
305
277
} ) ;
306
- } ) ; ;
278
+ } ) ;
0 commit comments