fix: groups.updateCover

This commit is contained in:
Barış Soner Uşaklı
2020-07-09 18:12:51 -04:00
parent c513b88dff
commit 73ddf1cb98
2 changed files with 28 additions and 5 deletions

View File

@@ -1387,9 +1387,9 @@ describe('Groups', function () {
});
it('should fail if user is not logged in or not owner', function (done) {
socketGroups.cover.update({ uid: 0 }, {}, function (err) {
socketGroups.cover.update({ uid: 0 }, { imageData: 'asd' }, function (err) {
assert.equal(err.message, '[[error:no-privileges]]');
socketGroups.cover.update({ uid: regularUid }, { groupName: 'Test' }, function (err) {
socketGroups.cover.update({ uid: regularUid }, { groupName: 'Test', imageData: 'asd' }, function (err) {
assert.equal(err.message, '[[error:no-privileges]]');
done();
});
@@ -1404,7 +1404,7 @@ describe('Groups', function () {
type: 'image/png',
},
};
socketGroups.cover.update({ uid: adminUid }, data, function (err, data) {
Groups.updateCover({ uid: adminUid }, data, function (err, data) {
assert.ifError(err);
Groups.getGroupFields('Test', ['cover:url'], function (err, groupData) {
assert.ifError(err);
@@ -1434,6 +1434,20 @@ describe('Groups', function () {
});
});
it('should fail to upload group cover with invalid image', function (done) {
var data = {
groupName: 'Test',
file: {
path: imagePath,
type: 'image/png',
},
};
socketGroups.cover.update({ uid: adminUid }, data, function (err) {
assert.equal(err.message, '[[error:invalid-data]]');
done();
});
});
it('should fail to upload group cover with invalid image', function (done) {
var data = {
groupName: 'Test',