--- a/test/underscore-methods.js Wed Jun 22 14:38:03 2016 +0800
+++ b/test/underscore-methods.js Sun Jun 26 15:30:33 2016 +0800
deepEqual(shard.initial(), [a, b], 'initial() works');
deepEqual(shard.rest(), [b, c], 'rest() works');
- equal(shard.indexOf(c), 2, 'indexOf() works');
- equal(shard.lastIndexOf(c), 2, 'lastIndexOf() works');
equal(shard.isEmpty(), false, 'isEmpty() works');
deepEqual(shard.toArray(), [a, b, c], 'toArray() works');
- equal(shard.findIndex(function(model) {
- return model.get('data').charCodeAt(0) % 2;
- }), 0, 'findIndex() works');
- equal(shard.findLastIndex(function(model) {
- return model.get('data').charCodeAt(0) % 2;
- }), 2, 'findLastIndex() works');
- equal(shard.contains(b), true, 'contains() works');
- deepEqual(shard.without(b), [a, c], 'without() works');
equal(shard.all(_.identity), true, 'all() works');
equal(shard.any(), true, 'any() works');
test('Underscore methods: searching and filtering', function() {
+ equal(shard.indexOf(c), 2, 'indexOf() works');
+ equal(shard.lastIndexOf(c), 2, 'lastIndexOf() works');
+ equal(shard.findIndex(function(model) {
+ return model.get('data').charCodeAt(0) % 2;
+ }), 0, 'findIndex() works');
+ equal(shard.findLastIndex(function(model) {
+ return model.get('data').charCodeAt(0) % 2;
+ }), 2, 'findLastIndex() works');
strictEqual(shard.min(function(model) {
return model.get('data').charCodeAt(0);
return model.get('data') == 'b';
}), [a, c], 'reject() works');
+ equal(shard.contains(b), true, 'contains() works');
+ deepEqual(shard.without(b), [a, c], 'without() works');
deepEqual(shard.difference([a, c]), [b], 'difference() works');