Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated cleanup function #148

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions integration-tests/rest-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,10 +725,7 @@ describe('REST API Plugin', function () {
createNotification(notification, deviceId);

function cleanUp(err) {
if (err) {
done(err);
}
unsubscribe(client, topic, done);
unsubscribe(client, topic, () => done(err));
}
}
}
Expand All @@ -755,10 +752,7 @@ describe('REST API Plugin', function () {
}

function cleanUp(err) {
if (err) {
done(err);
}
unsubscribe(client, topic, done);
unsubscribe(client, topic, () => done(err));
}
}
}
Expand Down Expand Up @@ -788,11 +782,7 @@ describe('REST API Plugin', function () {
}

function cleanUp(err) {
if (err) {
return done(err);
}

unsubscribe(client, topic, done);
unsubscribe(client, topic, () => done(err));
}
}
}
Expand Down Expand Up @@ -1906,7 +1896,7 @@ describe('REST API Plugin', function () {
});
});

describe('#Plugin List', function () {
describe.only('#Plugin List', function () {
var PLUGIN_USER = utils.getName('plugin');
var PLUGIN1 = utils.getName('plugin');
var PLUGIN2 = utils.getName('plugin');
Expand Down Expand Up @@ -2049,7 +2039,7 @@ describe('REST API Plugin', function () {
})
});

it('should get sorteed plugins by Id ASC', function (done) {
it('should get sorted plugins by Id ASC', function (done) {
var params = {
jwt: utils.jwt.admin
};
Expand Down
70 changes: 15 additions & 55 deletions integration-tests/ws-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -710,14 +710,11 @@ describe('WebSocket API Command', function () {
.send();

function cleanUp(err) {
if (err) {
return done(err);
}

client.on({
action: 'command/unsubscribe',
status: 'success'
}, done);
}, () => done(err));

client.send({
action: 'command/unsubscribe',
Expand Down Expand Up @@ -791,16 +788,13 @@ describe('WebSocket API Command', function () {
});

function cleanUp(err) {
if (err) {
return done(err);
}

var requestId = getRequestId();

client.on({
action: 'command/unsubscribe',
requestId: requestId
}, done);
}, () => done(err));

client.send({
action: 'command/unsubscribe',
Expand Down Expand Up @@ -881,15 +875,11 @@ describe('WebSocket API Command', function () {
.send();

function cleanUp(err) {
if (err) {
return done(err);
}

var requestId = getRequestId();
conn.on({
action: 'command/unsubscribe',
requestId: requestId
}, done);
}, () => done(err));
conn.send({
action: 'command/unsubscribe',
requestId: requestId
Expand Down Expand Up @@ -951,13 +941,10 @@ describe('WebSocket API Command', function () {
});

function cleanUp(err) {
if (err) {
return done(err);
}
conn.on({
action: 'command/unsubscribe',
status: 'success'
}, done);
}, () => done(err));

conn.send({
action: 'command/unsubscribe',
Expand Down Expand Up @@ -1013,14 +1000,10 @@ describe('WebSocket API Command', function () {
});

function cleanUp(err) {
if (err) {
return done(err);
}

conn.on({
action: 'command/unsubscribe',
status: 'success'
}, done);
}, () => done(err));

conn.send({
action: 'command/unsubscribe',
Expand Down Expand Up @@ -1077,13 +1060,10 @@ describe('WebSocket API Command', function () {
});

function cleanUp(err) {
if (err) {
return done(err);
}
adminConn.on({
action: 'command/unsubscribe',
status: 'success'
}, done);
}, () => done(err));
adminConn.send({
action: 'command/unsubscribe',
requestId: getRequestId(),
Expand Down Expand Up @@ -1153,10 +1133,6 @@ describe('WebSocket API Command', function () {


function cleanUp(err) {
if (err) {
return done(err);
}

adminConn.send({
action: 'device/delete',
requestId: requestId,
Expand All @@ -1166,11 +1142,11 @@ describe('WebSocket API Command', function () {
action: 'device/delete',
requestId: requestId,
status: 'success'
}, (err, result) => {
}, () => {
adminConn.on({
action: 'command/unsubscribe',
status: 'success'
}, done);
}, () => done(err));
adminConn.send({
action: 'command/unsubscribe',
requestId: getRequestId(),
Expand Down Expand Up @@ -1239,10 +1215,6 @@ describe('WebSocket API Command', function () {
.send();

function cleanUp(err) {
if (err) {
return done(err);
}

conn.send({
action: 'device/delete',
requestId: requestId,
Expand All @@ -1252,12 +1224,11 @@ describe('WebSocket API Command', function () {
action: 'device/delete',
requestId: requestId,
status: 'success'
}, (err, result) => {

}, () => {
conn.on({
action: 'command/unsubscribe',
status: 'success'
}, done);
}, () => done(err));
conn.send({
action: 'command/unsubscribe',
requestId: getRequestId(),
Expand Down Expand Up @@ -1337,22 +1308,18 @@ describe('WebSocket API Command', function () {
});

function cleanUp(err) {
if (err) {
return done(err);
}

var requestId = getRequestId();

conn.on({
action: 'device/delete',
requestId: requestId,
status: 'success'
}, (err, result) => {
}, () => {
var requestId = getRequestId();
conn.on({
action: 'command/unsubscribe',
requestId: requestId
}, done);
}, () => done(err));
conn.send({
action: 'command/unsubscribe',
requestId: requestId,
Expand Down Expand Up @@ -1427,10 +1394,6 @@ describe('WebSocket API Command', function () {
})

function cleanUp(err) {
if (err) {
return done(err);
}

conn.send({
action: 'device/delete',
requestId: requestId,
Expand All @@ -1440,13 +1403,13 @@ describe('WebSocket API Command', function () {
action: 'device/delete',
requestId: requestId,
status: 'success'
}, (err, result) => {
}, () => {
var requestId = getRequestId();

conn.on({
action: 'command/unsubscribe',
requestId: requestId
}, done);
}, () => done(err));

conn.send({
action: 'command/unsubscribe',
Expand Down Expand Up @@ -1730,13 +1693,10 @@ describe('WebSocket API Command', function () {
.send();

function cleanUp(err) {
if (err) {
return done(err);
}
client.on({
action: 'command/unsubscribe',
status: 'success'
}, done);
}, () => done(err));
client.send({
action: 'command/unsubscribe',
requestId: getRequestId(),
Expand Down
Loading