コード例 #1
0
test("sum entire series (with timestamp)", function (t) {
  t.plan(1)

  var now = 1378510797174
  var series = gen({start: now, until: now + 1000, interval: 100})

  var expectedEnd = floordate(now, "day").getTime()

  function check(results) {
    var expected = [{_t: expectedEnd, gen: 55}]
    t.deepEquals(results, expected, "Got expected results")
  }
  series.pipe(agg.sum("_t", "day")).pipe(concat(check))
})
コード例 #2
0
 function slot(record, encoding, callback) {
   if (this._windowSet == null) this._windowSet = []
   var floored = floorDate(record[seqKey], segment).getTime()
   if (this._windowKey != null && floored != this._windowKey) {
     var aggregate = {set: this._windowSet.splice(0)}
     aggregate[seqKey] = this._windowKey
     this.push(aggregate)
     this._windowSet = []
   }
   this._windowKey = floored
   record[seqKey] = floored
   this._windowSet.push(record)
   return callback()
 }
コード例 #3
0
ファイル: prepopulate.test.js プロジェクト: thanpolas/kansas
 beforeEach(function() {
   var floored = floordate(Date.now(), 'month');
   var moveFwd = 40 * 24 * 3600 * 1000;
   clock = sinon.useFakeTimers(floored.getTime() + moveFwd);
 });
コード例 #4
0
ファイル: usage.test.js プロジェクト: margaritis/kansas
 beforeEach(function() {
   var floored = floordate(Date.now(), 'month');
   clock = sinon.useFakeTimers(floored.getTime());
 });