mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Fix batch (#6248)
* Use the delta plugin data to show the delta in the clock views * Update Node checks * Fix disabling the BG alarms for simple alarms * Load battery and other rare events up to two months back * Possibly fixes compatibility with ios9 - needs testing * Unified black and color clock layouts * Update clock data every 20 seconds * Update clock time every second * Fix how CSP policy is set for Helmet, fixes #6260 * Authorization fix for misformatted URLs * Added unit test for batch upload of CGM entries * Improved / removed some logging * Test if user is in read only mode when Nightscout starts and give an error if so
This commit is contained in:
@@ -307,4 +307,66 @@ describe('Entries REST api', function ( ) {
|
||||
});
|
||||
});
|
||||
|
||||
it('post multipole entries, query, delete, verify gone', function (done) {
|
||||
// insert a glucose entry - needs to be unique from example data
|
||||
console.log('Inserting glucose entry')
|
||||
request(self.app)
|
||||
.post('/entries/')
|
||||
.set('api-secret', self.env.api_secret || '')
|
||||
.send([{
|
||||
"type": "sgv", "sgv": "199", "dateString": "2014-07-20T00:44:15.000-07:00"
|
||||
, "date": 1405791855000, "device": "dexcom", "direction": "NOT COMPUTABLE"
|
||||
}, {
|
||||
"type": "sgv", "sgv": "200", "dateString": "2014-07-20T00:44:15.001-07:00"
|
||||
, "date": 1405791855001, "device": "dexcom", "direction": "NOT COMPUTABLE"
|
||||
}])
|
||||
.expect(200)
|
||||
.end(function (err) {
|
||||
if (err) {
|
||||
done(err);
|
||||
} else {
|
||||
// make sure treatment was inserted successfully
|
||||
console.log('Ensuring glucose entry was inserted successfully');
|
||||
request(self.app)
|
||||
.get('/entries.json?find[dateString][$gte]=2014-07-20&count=100')
|
||||
.set('api-secret', self.env.api_secret || '')
|
||||
.expect(200)
|
||||
.expect(function (response) {
|
||||
var entry = response.body[0];
|
||||
response.body.length.should.equal(2);
|
||||
entry.sgv.should.equal('200');
|
||||
entry.utcOffset.should.equal(-420);
|
||||
})
|
||||
.end(function (err) {
|
||||
if (err) {
|
||||
done(err);
|
||||
} else {
|
||||
// delete the glucose entry
|
||||
console.log('Deleting test glucose entry');
|
||||
request(self.app)
|
||||
.delete('/entries.json?find[dateString][$gte]=2014-07-20&count=100')
|
||||
.set('api-secret', self.env.api_secret || '')
|
||||
.expect(200)
|
||||
.end(function (err) {
|
||||
if (err) {
|
||||
done(err);
|
||||
} else {
|
||||
// make sure it was deleted
|
||||
console.log('Testing if glucose entries were deleted');
|
||||
request(self.app)
|
||||
.get('/entries.json?find[dateString][$gte]=2014-07-20&count=100')
|
||||
.set('api-secret', self.env.api_secret || '')
|
||||
.expect(200)
|
||||
.expect(function (response) {
|
||||
response.body.length.should.equal(0);
|
||||
})
|
||||
.end(done);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user