forked from inventures/hatchjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.audit.test.js
32 lines (26 loc) · 872 Bytes
/
api.audit.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var should = require('./'), app, Event, audit;
var async = require('async');
describe('api/audit', function() {
before(function(done) {
app = getApp(function() {
Event = app.compound.models.Event;
audit = app.compound.hatch.audit;
Event.destroyAll(done);
});
});
it('should track event', function(done) {
audit.track(1, 'event', {foo: 'bar'}, function() {
done();
});
});
it('should retrieve events by particular type', function(done) {
Event.all({where: {type: '1-event'}}, function(err, events) {
done();
});
});
it('should retrieve events for particular day', function(done) {
Event.all({where: {day: '1-event-' + Math.floor(Date.now() / 86400000)}}, function(err, events) {
done();
});
});
});