it('de-dupes settings so that only *changes* to settings are returned', function() {
   var thisSettings = _.map(mockSettingsNoChanges, function(obj) { return _.cloneDeep(obj); });
   thisSettings[3].fallRateEnabled = true;
   thisSettings[3].riseRateEnabled = true;
   thisSettings[3].lowAlarmValue = 80;
   thisSettings[3].highAlarmValue = 200;
   // continue changes to final settings object, which should then be de-duped since nothing's changed
   thisSettings[4].fallRateEnabled = true;
   thisSettings[4].riseRateEnabled = true;
   thisSettings[4].lowAlarmValue = 80;
   thisSettings[4].highAlarmValue = 200;
   var convertedTransmitterId = '637QJ';
   var res = userSettingsChanges(thisSettings, {builder: builder});
   expect(res.settingChanges.length).to.equal(2);
   expect(res.settingChanges[0].transmitterId).to.equal(convertedTransmitterId);
   expect(res.settingChanges[0].payload.internalTime).to.equal('2014-11-23T06:55:07');
   expect(res.settingChanges[0].rateOfChangeAlerts.fallRate.enabled).to.be.false;
   expect(res.settingChanges[0].rateOfChangeAlerts.riseRate.enabled).to.be.false;
   expect(res.settingChanges[0].lowAlerts.level).to.equal(70);
   expect(res.settingChanges[0].highAlerts.level).to.equal(180);
   expect(res.settingChanges[0].transmitterId).to.equal(convertedTransmitterId);
   expect(res.settingChanges[1].payload.internalTime).to.equal('2014-12-25T21:34:45');
   expect(res.settingChanges[1].rateOfChangeAlerts.fallRate.enabled).to.be.true;
   expect(res.settingChanges[1].rateOfChangeAlerts.riseRate.enabled).to.be.true;
   expect(res.settingChanges[1].lowAlerts.level).to.equal(80);
   expect(res.settingChanges[1].highAlerts.level).to.equal(200);
 });
 it('is a function', function() {
   expect(typeof userSettingsChanges).to.equal('function');
 });
 _.each(res.settingChanges, function(change) {
   expect(change.time.slice(0,4)).not.to.equal('2009');
 });
 it('produces one settings object at earliest data when no changes', function() {
   var res = userSettingsChanges(mockSettingsNoChanges, {builder: builder});
   expect(res.settingChanges.length).to.equal(1);
   expect(res.settingChanges[0].payload.internalTime).to.equal('2014-11-23T06:55:07');
 });
Exemplo n.º 5
0
 .then(function() {
   expect('.js-navbar-user').dom.to.be.visible();
   done();
 });
Exemplo n.º 6
0
 .then(function() {
   expect('.js-form-notification').dom.to.contain.text('Wrong username or password');
   done();
 });
Exemplo n.º 7
0
 it('should return `undefined` by default if value not found', function() {
   expect(getIn(obj, ['a', 'b', 'd'])).to.equal(undefined);
 });
Exemplo n.º 8
0
 it('should return the specified value for `notFound` if value not found', function() {
   expect(getIn(obj, ['a', 'b', 'd'], null)).to.equal(null);
   expect(getIn(obj, ['a', 'b', 'd'], 'foo')).to.equal('foo');
 });
Exemplo n.º 9
0
 it('should be a function', function() {
   expect(typeof getIn).to.equal('function');
 });
Exemplo n.º 10
0
 it('should return a value from following a path of nested object keys', function() {
   expect(getIn(obj, ['a', 'b', 'c'])).to.equal(3);
 });
Exemplo n.º 11
0
    it('returns false if no logged-in user object', function() {
      app.state.user = null;

      expect(appState.isLoggedIn()).to.not.be.true;
    });
Exemplo n.º 12
0
    it('returns true if there is a logged-in user object', function() {
      app.state.user = {userid: '11'};

      expect(appState.isLoggedIn()).to.be.true;
    });
Exemplo n.º 13
0
 it('binds to app component', function() {
   app.state.FOO = 'bar';
   expect(appState.app.state.FOO).to.equal('bar');
 });
Exemplo n.º 14
0
    it('returns false if no upload in progress', function() {
      app.state.uploads = [];

      expect(appState.hasUploadInProgress()).to.not.be.true;
    });
 platform.login(user,function(error,data){
   saveSession(data.userid,data.token);
   expect(error).to.not.exist;
   expect(data).to.exist;
   done();
 });