Make profile route tests work

This commit is contained in:
Johannes Zellner
2021-07-09 12:07:09 +02:00
parent 8c87f97054
commit 35dc2141ea

View File

@@ -262,12 +262,8 @@ describe('Profile API', function () {
it('has no avatar by default (public route)', async function () {
const response = await superagent.get(`${serverUrl}/api/v1/profile`)
.query({ access_token: user.token });
expect(response.body.avatarUrl).to.contain('www.gravatar.com');
const response2 = await superagent.get(`${serverUrl}/api/v1/profile/avatar/${user.id}`)
.ok(() => true);
expect(response2.statusCode).to.equal(404);
expect(response.body.avatarUrl).to.contain('/img/');
});
it('can set avatar', async function () {
@@ -288,23 +284,5 @@ describe('Profile API', function () {
expect(response2.statusCode).to.equal(200);
});
it('can clear avatar', async function () {
const response = await superagent.del(`${serverUrl}/api/v1/profile/avatar`)
.query({ access_token: user.token });
expect(response.statusCode).to.be(202);
});
it('did clear avatar', async function () {
const response = await superagent.get(`${serverUrl}/api/v1/profile`)
.query({ access_token: user.token });
expect(response.body.avatarUrl).to.contain('www.gravatar.com');
const response2 = await superagent.get(`${serverUrl}/api/v1/profile/avatar/${user.id}`)
.ok(() => true);
expect(response2.statusCode).to.equal(404);
});
});
});