From f619de0e435f7ac3abad2ec772397486358b56e7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Nov 2020 09:50:12 +0100 Subject: Add tests to gif resizer --- server/tests/api/users/users.ts | 23 ++++++++++++++++++++--- server/tests/fixtures/avatar-resized.gif | Bin 0 -> 88318 bytes server/tests/fixtures/avatar.gif | Bin 0 -> 46917 bytes 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 server/tests/fixtures/avatar-resized.gif create mode 100644 server/tests/fixtures/avatar.gif (limited to 'server/tests') diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index edb0b4bb3..fe83ca041 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts @@ -602,8 +602,8 @@ describe('Test users', function () { expect(user.account.description).to.be.null }) - it('Should be able to update my avatar', async function () { - const fixture = 'avatar.png' + it('Should be able to update my avatar with a gif', async function () { + const fixture = 'avatar.gif' await updateMyAvatar({ url: server.url, @@ -614,7 +614,24 @@ describe('Test users', function () { const res = await getMyUserInformation(server.url, accessTokenUser) const user = res.body - await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.png') + await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.gif') + }) + + it('Should be able to update my avatar with a gif, and then a png', async function () { + for (const extension of [ '.png', '.gif' ]) { + const fixture = 'avatar' + extension + + await updateMyAvatar({ + url: server.url, + accessToken: accessTokenUser, + fixture + }) + + const res = await getMyUserInformation(server.url, accessTokenUser) + const user = res.body + + await testImage(server.url, 'avatar-resized', user.account.avatar.path, extension) + } }) it('Should be able to update my display name', async function () { diff --git a/server/tests/fixtures/avatar-resized.gif b/server/tests/fixtures/avatar-resized.gif new file mode 100644 index 000000000..81a82189e Binary files /dev/null and b/server/tests/fixtures/avatar-resized.gif differ diff --git a/server/tests/fixtures/avatar.gif b/server/tests/fixtures/avatar.gif new file mode 100644 index 000000000..f29707760 Binary files /dev/null and b/server/tests/fixtures/avatar.gif differ -- cgit v1.2.3