Skip to content

Commit

Permalink
fix COB pill formatting; add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoncalabrese committed Jun 27, 2015
1 parent e5cf3cd commit e5a2c84
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/plugins/cob.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function init() {
}

sbx.pluginBase.updatePillText(sbx, {
value: displayCob + " g"
value: displayCob + 'g'
, label: 'COB'
, info: info
});
Expand Down
24 changes: 24 additions & 0 deletions tests/cob.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,29 @@ describe('COB', function ( ) {
result5.cob.should.equal(0);
});

it('set a pill to the current COB', function (done) {

var app = {};
var clientSettings = {};

var data = {
treatments: [{carbs: "8", "created_at": new Date()}]
, profile: require('../lib/profilefunctions')([profileData])
};

var pluginBase = {
updatePillText: function mockedUpdatePillText (plugin, options) {
options.value.should.equal('8g');
done();
}
};

var sandbox = require('../lib/sandbox')();
var sbx = sandbox.clientInit(app, clientSettings, Date.now(), pluginBase, data);
cob.setProperties(sbx);
cob.updateVisualisation(sbx);

});


});

0 comments on commit e5a2c84

Please sign in to comment.