fix: tests

v1.18.x
Barış Soner Uşaklı 5 years ago
parent 2444ed5c88
commit 3caa387ac6

@ -24,7 +24,7 @@ module.exports = function (Groups) {
} }
const memberCount = data.hasOwnProperty('ownerUid') ? 1 : 0; const memberCount = data.hasOwnProperty('ownerUid') ? 1 : 0;
const isPrivate = data.hasOwnProperty('private') ? parseInt(data.private, 10) : 1; const isPrivate = data.hasOwnProperty('private') && data.private !== undefined ? parseInt(data.private, 10) === 1 : true;
const groupData = { const groupData = {
name: data.name, name: data.name,
slug: utils.slugify(data.name), slug: utils.slugify(data.name),
@ -35,7 +35,7 @@ module.exports = function (Groups) {
memberCount: memberCount, memberCount: memberCount,
hidden: isHidden ? 1 : 0, hidden: isHidden ? 1 : 0,
system: isSystem ? 1 : 0, system: isSystem ? 1 : 0,
private: isPrivate, private: isPrivate ? 1 : 0,
disableJoinRequests: disableJoinRequests, disableJoinRequests: disableJoinRequests,
disableLeave: disableLeave, disableLeave: disableLeave,
}; };

@ -1161,7 +1161,8 @@ describe('Groups', function () {
assert.equal(groupData.name, 'newgroup'); assert.equal(groupData.name, 'newgroup');
assert.equal(groupData.description, 'group created by admin'); assert.equal(groupData.description, 'group created by admin');
assert.equal(groupData.ownerUid, adminUid); assert.equal(groupData.ownerUid, adminUid);
assert.equal(groupData.private, true); assert.equal(groupData.private, 1);
assert.equal(groupData.hidden, 0);
assert.equal(groupData.memberCount, 1); assert.equal(groupData.memberCount, 1);
done(); done();
}); });

Loading…
Cancel
Save