-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from megawac/params
Notification on param set/delete completion (+tests)
- Loading branch information
Showing
3 changed files
with
72 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
var expect = require('chai').expect; | ||
var ROSLIB = require('../..'); | ||
|
||
describe('Param setting', function() { | ||
var ros = new ROSLIB.Ros({ | ||
url: 'ws://localhost:9090' | ||
}); | ||
var param = ros.Param({ | ||
name: '/test/foo' | ||
}); | ||
|
||
it('Param generics', function() { | ||
expect(param).to.be.instanceOf(ROSLIB.Param); | ||
expect(param.name).to.be.equal('/test/foo'); | ||
}); | ||
|
||
it('Param.set no callback', function(done) { | ||
param.set('foo'); | ||
setTimeout(done, 500); | ||
}); | ||
|
||
it('Param.get', function(done) { | ||
param.get(function(result) { | ||
expect(result).to.be.equal('foo'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Param.set w/ callback', function(done) { | ||
param.set('bar', function() { | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Param.get', function(done) { | ||
param.get(function(result) { | ||
expect(result).to.be.equal('bar'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('ros.getParams', function(done) { | ||
ros.getParams(function(params) { | ||
expect(params).to.include(param.name); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Param.delete', function(done) { | ||
param.delete(function() { | ||
ros.getParams(function(params) { | ||
expect(params).to.not.include(param.name); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |