Add webp avatar upload tests
This commit is contained in:
parent
3fafcb15a1
commit
3aa15c44b0
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
Binary file not shown.
After Width: | Height: | Size: 953 B |
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
After Width: | Height: | Size: 488 B |
|
@ -272,8 +272,8 @@ describe('Test users', function () {
|
|||
}
|
||||
})
|
||||
|
||||
it('Should be able to update my avatar with a gif, and then a png', async function () {
|
||||
for (const extension of [ '.png', '.gif' ]) {
|
||||
it('Should be able to update my avatar with a gif, a webp and a png', async function () {
|
||||
for (const extension of [ '.png', '.gif', '.webp' ]) {
|
||||
const fixture = 'avatar' + extension
|
||||
|
||||
await server.users.updateMyAvatar({ token: userToken, fixture })
|
||||
|
|
|
@ -62,12 +62,13 @@ async function testAvatarSize (options: {
|
|||
// We don't test big GIF avatars
|
||||
if (extension === '.gif' && avatar.width > 150) return
|
||||
|
||||
const data = await readFile(buildAbsoluteFixturePath(imageName + extension))
|
||||
const fixturePath = buildAbsoluteFixturePath(imageName + extension)
|
||||
const data = await readFile(fixturePath)
|
||||
const minLength = data.length - ((40 * data.length) / 100)
|
||||
const maxLength = data.length + ((40 * data.length) / 100)
|
||||
|
||||
expect(body.length).to.be.above(minLength, 'the generated image is way smaller than the recorded fixture')
|
||||
expect(body.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture')
|
||||
expect(body.length).to.be.above(minLength, 'the generated image is way smaller than the recorded fixture ' + fixturePath)
|
||||
expect(body.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture ' + fixturePath)
|
||||
}
|
||||
|
||||
async function testImageGeneratedByFFmpeg (url: string, imageName: string, imageHTTPPath: string, extension = '.jpg') {
|
||||
|
|
Loading…
Reference in New Issue