Skip to content

Commit

Permalink
chore(image-tests): add more tests for changing other user
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonVreling committed Dec 7, 2024
1 parent caf1491 commit 51b0f18
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/api/users-image-remove.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,23 @@ describe('Users image remove', () => {

expect(secondRequest.statusCode).toEqual(200);

let userFromDb = await User.findByPk(user.id);

const res = await request({
uri: '/members/' + user.id + '/image',
method: 'DELETE',
headers: { 'X-Auth-Token': token.value }
});

expect(res.statusCode).toEqual(200);
expect(res.body.success).toEqual(true);
expect(res.body).toHaveProperty('message');

const oldImgPath = path.join(__dirname, '..', '..', config.media_dir, 'headimages', userFromDb.image);
expect(fs.existsSync(oldImgPath)).toEqual(false);

userFromDb = await User.findByPk(user.id);
expect(userFromDb.image).toEqual(null);

const adminFromDb = await User.findByPk(admin.id);

Expand Down

0 comments on commit 51b0f18

Please sign in to comment.