Skip to content
This repository
Browse code

groupby tests

  • Loading branch information...
commit ba3c30b6bfd7f5138e74fcfb60689d92f7c95f96 1 parent 72a252c
Alex Graul alexgraul authored

Showing 1 changed file with 6 additions and 3 deletions. Show diff stats Hide diff stats

  1. +6 3 test/unit/derived.js
9 test/unit/derived.js
@@ -169,12 +169,12 @@
169 169 {
170 170 name : "state",
171 171 type : "string",
172   - data : ["AZ", "AZ", "AZ", "MA", "MA", "MA"]
  172 + data : ["AZ", "AZ", "AZ", "MA", "MA", "MA", "AZ", "MA", "MA"]
173 173 },
174 174 {
175 175 name : "count",
176 176 type : "number",
177   - data : [1,2,3,4,5,6]
  177 + data : [1,2,3,4,5,6,null,null,undefined]
178 178 },
179 179 {
180 180 name : "anothercount",
@@ -318,6 +318,9 @@
318 318 ["count", "anothercount"], {
319 319 method : function(array) {
320 320 return _.reduce(array, function(memo, num){
  321 + if ( _.isUndefined(num) || _.isNull(num) ) {
  322 + num = 1;
  323 + }
321 324 return memo * num;
322 325 }, 1);
323 326 }
@@ -325,7 +328,7 @@
325 328
326 329 ok(_.isEqual(groupedData._columns[2].data, ["AZ", "MA"]), "states correct");
327 330 ok(_.isEqual(groupedData._columns[3].data, [6,120]), "counts correct");
328   - ok(_.isEqual(groupedData._columns[4].data, [6000,120000]), "anothercounts correct" + groupedData._columns[3].data);
  331 + ok(_.isEqual(groupedData._columns[4].data, [6000,120000]), "anothercounts correct");
329 332 });
330 333 });
331 334

0 comments on commit ba3c30b

Please sign in to comment.
Something went wrong with that request. Please try again.