Skip to content

Commit

Permalink
#125 cleanup
Browse files Browse the repository at this point in the history
- updated tests to better handle timestamp checks on push
- update mongodb package dep
  • Loading branch information
itayw committed Aug 11, 2014
1 parent 523439e commit 1cd26fd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -68,7 +68,7 @@
"humanize-number": "0.0.2",
"jade": "*",
"joola.cli": "^0.1.0",
"joola.datastore-mongodb": "^0.0.8",
"joola.datastore-mongodb": "^0.0.9",
"joola.datastore-influxdb": "^0.0.7",
"joola.sdk": "^0.7.0",
"js-yaml": "~3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/basic-timestamps.json
Expand Up @@ -6,7 +6,7 @@
"return": 1.1,
"currency": 87,
"operator": 81,
"timestamp": "2013-10-20T09:09:54.827Z",
"timestamp": "2013-10-20T08:09:54.827Z",
"stake": 123.0,
"win": true,
"gameround_id": "1234"
Expand Down
2 changes: 1 addition & 1 deletion test/unit/6_beacon/beacon-basic.spec.js
Expand Up @@ -63,7 +63,7 @@ describe("beacon-basic", function () {
var self = this;
var docs = require('../../fixtures/basic-timestamps.json');

engine.beacon.insert(self.context, self.context.user.workspace, self.collection + '-dups', docs, function (err, docs) {
engine.beacon.insert(self.context, self.context.user.workspace, self.collection + '-times', docs, function (err, docs) {
if (err)
return done(err);

Expand Down
26 changes: 25 additions & 1 deletion test/unit/7_query/query-basic.spec.js
Expand Up @@ -674,7 +674,7 @@ describe("query-basic", function () {
metrics: [

],
collection: this.collection
collection: this.collection + '-times'
};
joola_proxy.query.fetch(this.context, query, function (err, result) {
if (err)
Expand All @@ -687,4 +687,28 @@ describe("query-basic", function () {
return done();
});
});

it("should verify last_n_items by timestamp", function (done) {
var query = {
timeframe: 'last_1_items',
interval: 'second',
dimensions: ['timestamp'],
metrics: [

],
collection: this.collection + '-times'
};
joola_proxy.query.fetch(this.context, query, function (err, result) {
if (err)
return done(err);

//console.log(require('util').inspect(result, {depth: null, colors: true}));

expect(result).to.be.ok;
expect(result.documents).to.be.ok;
expect(result.documents.length).to.equal(1);
expect(new Date(result.documents[0].values.timestamp).getTime()).to.equal(new Date("2013-10-20T11:09:54.000Z").getTime());
return done();
});
});
});

0 comments on commit 1cd26fd

Please sign in to comment.