Hexagon / node-telldus

Node bindings for telldus-core
Other
34 stars 10 forks source link

Some async methods does not seem to work as expected. #24

Closed kmpm closed 10 years ago

kmpm commented 10 years ago

Things like setNameSync works but not setName or at least it does not work in the sense that I'm able to retrieve the new name within the callback. It will be written to the tellstick.conf.

I have strong suspicions that all similar methods have issues, setProtocol, setModel etc but more testing is needed.

This works and the new name is returned.

    it('setNameSync', function(){
      var setResult = telldus.setNameSync(deviceId, 'Newly created');
      var name = telldus.getNameSync(deviceId);
      name.should.equal('Newly created');
      setResult.should.equal(true, 'set worked but did still return error');
    });

This doesn't work. Even though the call to setName does not generate an error then new name will not be returned by getNameSync. The assertion that fails is - 'setName did not fail but can not get new values'

    it('setName', function(done){
      telldus.setName(deviceId, 'Newly created2', function(err){
        should.not.exist(err);
        var name = telldus.getNameSync(deviceId);
        name.should.equal('Newly created2', 'setName did not fail but can not get new values');
        done(err);
      });
    });

Until issue #18 is fixed mocha will report this as a timeout error but if you look carefully at the output you will see the 'setName did not fail but can not get new values'

Hexagon commented 10 years ago

Didn't my fix solve #18?

Edit: Nevermind :)

Hexagon commented 10 years ago

The problem is isolated, working on a solution!