Skip to content

Commit

Permalink
[nodejs] Update test cases based on node package 0.290.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
haoyunfeix committed Jan 30, 2018
1 parent 06c937d commit c21b19d
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 25 deletions.
4 changes: 2 additions & 2 deletions wrappers/nodejs/test/test-align.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ describe('Align test', function() {
});
});

it.skip('Testing process - invalid argument', () => {
it('Testing process - invalid argument', () => {
const align = new rs2.Align(rs2.stream.STREAM_COLOR);
assert.throws(() => {
align.process('dummy');
});
});

it.skip('Testing process - valid argument', () => {
it('Testing process - valid argument', () => {
const align = new rs2.Align(rs2.stream.STREAM_COLOR);
assert.doesNotThrow(() => {
align.process(frameset);
Expand Down
4 changes: 2 additions & 2 deletions wrappers/nodejs/test/test-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Config test', function() {
});

it('Testing method canResolve - 2 argument', () => {
assert.doesNotThrow(() => {
assert.throws(() => {
config.canResolve(pipeline, pipeline);
});
});
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('Config test', function() {
});

it('Testing method enableDevice - 0 argument', () => {
assert.doesNotThrow(() => {
assert.throws(() => {
config.enableDevice();
});
});
Expand Down
2 changes: 1 addition & 1 deletion wrappers/nodejs/test/test-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ describe('Context test', function() {

it('testing method - setDevicesChangedCallback', () => {
const context = new librealsense2.Context();
assert.doesNotThrow(() => {
assert.throws(() => {
context.setDevicesChangedCallback();
});
});
Expand Down
2 changes: 1 addition & 1 deletion wrappers/nodejs/test/test-devicehub.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('DeviceHub test', function() {
});
});

it.skip('Testing method isConnected - with invalid argument', () => {
it('Testing method isConnected - with invalid argument', () => {
assert.throws(() => {
devh.isConnected('dummy');
});
Expand Down
10 changes: 6 additions & 4 deletions wrappers/nodejs/test/test-devicelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ describe('DeviceList test', function() {
});

it('Testing method getDevice - without argument', () => {
let dev = devl.getDevice();
assert(dev instanceof rs2.Device);
assert.throws(() => {
devl.getDevice();
});
});

it('Testing method getDevice - return value', () => {
Expand All @@ -78,8 +79,9 @@ describe('DeviceList test', function() {
});

it('Testing method getDevice - with invalid argument', () => {
let dev = devl.getDevice('dummy');
assert(dev instanceof rs2.Device);
assert.throws(() => {
devl.getDevice('dummy');
});
});

it('Testing method contains - without argument', () => {
Expand Down
4 changes: 2 additions & 2 deletions wrappers/nodejs/test/test-playbackdevice.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('PlayBackDevice test', function() {

it('Testing constructor - 2 arguments', () => {
let ctx = new rs2.Context();
assert.doesNotThrow(() => {
assert.throws(() => {
ctx.loadDevice(fileName, 1);
});
});
Expand All @@ -129,7 +129,7 @@ describe('PlayBackDevice test', function() {
});
});

it.skip('Testing constructor - invalid file content', () => {
it('Testing constructor - invalid file content', () => {
let ctx = new rs2.Context();
assert.throws(() => {
ctx.loadDevice('./test-playbackdevice.js');
Expand Down
25 changes: 14 additions & 11 deletions wrappers/nodejs/test/test-sensor.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ describe('Sensor test', function() {
rs2.cleanup();
});

const optionsTestArray = [
rs2.option.option_enable_auto_exposure,
'enable_auto_exposure',
rs2.option.OPTION_ENABLE_AUTO_WHITE_BALANCE,
];

const optionsTestArray = Object.values(rs2.option);
optionsTestArray.pop();
optionsTestArray.pop();
it('Testing member - isValid', () => {
sensors.forEach((sensor) => {
assert.equal(typeof sensor.isValid, 'boolean');
Expand Down Expand Up @@ -197,7 +194,7 @@ describe('Sensor test', function() {
}
});
});
}).timeout(20 * 1000);
}).timeout(30 * 1000);

it('Testing method getOptionDescription', () => {
sensors.forEach((sensor) => {
Expand All @@ -212,9 +209,15 @@ describe('Sensor test', function() {
it('Testing method getOptionValueDescription', () => {
sensors.forEach((sensor) => {
optionsTestArray.forEach((o) => {
assert(typeof sensor.getOptionValueDescription(o) === 'string' ||
typeof sensor.getOptionValueDescription(o) === 'undefined'
);
let value;
if (sensor.supportsOption(o)) {
value = sensor.getOption(o);
} else {
value = 0;
}
assert(typeof sensor.getOptionValueDescription(o, value) === 'undefined' ||
typeof sensor.getOptionValueDescription(o, value) === 'string'
);
});
});
});
Expand Down Expand Up @@ -293,7 +296,7 @@ describe('Sensor test', function() {

it('Testing method setNotificationsCallback', () => {
sensors.forEach((sensor) => {
assert.doesNotThrow(() => {
assert.throws(() => {
sensor.setNotificationsCallback();
});
});
Expand Down
2 changes: 1 addition & 1 deletion wrappers/nodejs/test/test-streamprofile.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('StreamProfile test', function() {
assert.equal(Object.prototype.toString.call(ExtrinsicsObject.rotation), '[object Array]');
});

it.skip('Testing mothod getExtrinsicsTo - invalid argument', () => {
it('Testing mothod getExtrinsicsTo - invalid argument', () => {
assert.throws(() => {
streamProfiles[0].getExtrinsicsTo('dummy');
});
Expand Down
2 changes: 1 addition & 1 deletion wrappers/nodejs/test/test-videostreamprofile.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('VideoStreamProfile test', function() {
assert.equal(Object.prototype.toString.call(ExtrinsicsObject.rotation), '[object Array]');
});

it.skip('Testing method getExtrinsicsTo - invalid argument', () => {
it('Testing method getExtrinsicsTo - invalid argument', () => {
assert.throws(() => {
streamProfiles[0].getExtrinsicsTo('dummy');
});
Expand Down

0 comments on commit c21b19d

Please sign in to comment.