Created a test file for the basicget.js sample.
Had to modify the package.json by adding the following devDependencies:
chai : 4.4.1
mocha : 10.4.0
Also had to add a small modification in the basicget sample, so that the getMessage function could be tested. The following function :
function open(hConn, MQDetails) {
return new Promise(function resolver(resolve, reject){
debug_info('Opening MQ Connection');
// Define what we want to open, and how we want to open it.
let od = new mq.MQOD();
od.ObjectName = MQDetails.QUEUE_NAME;
od.ObjectType = MQC.MQOT_Q;
let openOptions = MQC.MQOO_INPUT_AS_Q_DEF|MQC.MQOO_OUTPUT;
mq.Open(hConn, od, openOptions, function(err, hObj) {
if (err) {
debug_warn('Error Detected Opening MQ Connection', err);
reject();
} else {
resolve(hObj);
}
});
});
}
Had to modify the openOptions to have the MQC.MQOO_OUTPUT option, so that in the testing of the getMessage function, I could put a sample message into the queue, and check if the message is being successfully recieved. I was planning to comment it out in the original file, and add a comment stating that one should only uncomment the line when testing. Would like to know your insight on the following.
Created a test file for the
basicget.js
sample. Had to modify thepackage.json
by adding the followingdevDependencies
:chai
:4.4.1
mocha
:10.4.0
Also had to add a small modification in the
basicget
sample, so that thegetMessage
function could be tested. The following function :Had to modify the openOptions to have the MQC.MQOO_OUTPUT option, so that in the testing of the
getMessage
function, I could put a sample message into the queue, and check if the message is being successfully recieved. I was planning to comment it out in the original file, and add a comment stating that one should only uncomment the line when testing. Would like to know your insight on the following.