Skip to content

Commit

Permalink
Fix the param tests
Browse files Browse the repository at this point in the history
  • Loading branch information
megawac committed Dec 11, 2014
1 parent 575e340 commit a86ee53
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions test/examples/params.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
var expect = require('chai').expect;
var ROSLIB = require('../..');

var expectedTopics = [
// '/turtle1/cmd_vel', '/turtle1/color_sensor', '/turtle1/pose',
// '/turtle2/cmd_vel', '/turtle2/color_sensor', '/turtle2/pose',
'/tf2_web_republisher/status', '/tf2_web_republisher/feedback',
// '/tf2_web_republisher/goal', '/tf2_web_republisher/result',
'/fibonacci/feedback', '/fibonacci/status', '/fibonacci/result'
];

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', function(done) {
param.set('bar', function() {
done();
});
expect(param).to.be.instanceOf(ROSLIB.Param);
expect(param.name).to.be.equal('/test/foo');
});

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.getTopics(function(topics) {
expect(topics).to.not.include(param.name);
ros.getParams(function(params) {
expect(params).to.not.include(param.name);
done();
});
});
Expand Down

0 comments on commit a86ee53

Please sign in to comment.