aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-02-24 14:48:15 +0100
committerChocobozzz <me@florianbigard.com>2023-02-24 15:10:13 +0100
commitd41f4a6dc69d098e9dc9173b7e1a586695ef7b97 (patch)
tree828ec8e08a1f326369e3720c310e2b059be9ead5 /server/tests/api
parent09a7ce0c60d3e98eedf58f245bf2aaba9837785b (diff)
downloadPeerTube-d41f4a6dc69d098e9dc9173b7e1a586695ef7b97.tar.gz
PeerTube-d41f4a6dc69d098e9dc9173b7e1a586695ef7b97.tar.zst
PeerTube-d41f4a6dc69d098e9dc9173b7e1a586695ef7b97.zip
Improve image test comparison
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/users/users.ts6
-rw-r--r--server/tests/api/videos/video-imports.ts28
2 files changed, 19 insertions, 15 deletions
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index f1e170971..1c00f9a93 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -1,7 +1,7 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { testImage } from '@server/tests/shared' 4import { testImageSize } from '@server/tests/shared'
5import { AbuseState, HttpStatusCode, UserAdminFlag, UserRole, VideoPlaylistType } from '@shared/models' 5import { AbuseState, HttpStatusCode, UserAdminFlag, UserRole, VideoPlaylistType } from '@shared/models'
6import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' 6import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
7 7
@@ -274,7 +274,7 @@ describe('Test users', function () {
274 274
275 const user = await server.users.getMyInfo({ token: userToken }) 275 const user = await server.users.getMyInfo({ token: userToken })
276 for (const avatar of user.account.avatars) { 276 for (const avatar of user.account.avatars) {
277 await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.gif') 277 await testImageSize(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.gif')
278 } 278 }
279 }) 279 })
280 280
@@ -286,7 +286,7 @@ describe('Test users', function () {
286 286
287 const user = await server.users.getMyInfo({ token: userToken }) 287 const user = await server.users.getMyInfo({ token: userToken })
288 for (const avatar of user.account.avatars) { 288 for (const avatar of user.account.avatars) {
289 await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, extension) 289 await testImageSize(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, extension)
290 } 290 }
291 } 291 }
292 }) 292 })
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index 5636de45f..80215f038 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -68,6 +68,8 @@ async function checkVideoServer2 (server: PeerTubeServer, id: number | string) {
68 expect(video.description).to.equal('my super description') 68 expect(video.description).to.equal('my super description')
69 expect(video.tags).to.deep.equal([ 'supertag1', 'supertag2' ]) 69 expect(video.tags).to.deep.equal([ 'supertag1', 'supertag2' ])
70 70
71 await testImage(server.url, 'thumbnail', video.thumbnailPath)
72
71 expect(video.files).to.have.lengthOf(1) 73 expect(video.files).to.have.lengthOf(1)
72 74
73 const bodyCaptions = await server.captions.list({ videoId: id }) 75 const bodyCaptions = await server.captions.list({ videoId: id })
@@ -254,18 +256,20 @@ describe('Test video imports', function () {
254 it('Should import a video on server 2 with some fields', async function () { 256 it('Should import a video on server 2 with some fields', async function () {
255 this.timeout(60_000) 257 this.timeout(60_000)
256 258
257 const attributes = { 259 const { video } = await servers[1].imports.importVideo({
258 targetUrl: FIXTURE_URLS.youtube, 260 attributes: {
259 channelId: servers[1].store.channel.id, 261 targetUrl: FIXTURE_URLS.youtube,
260 privacy: VideoPrivacy.PUBLIC, 262 channelId: servers[1].store.channel.id,
261 category: 10, 263 privacy: VideoPrivacy.PUBLIC,
262 licence: 7, 264 category: 10,
263 language: 'en', 265 licence: 7,
264 name: 'my super name', 266 language: 'en',
265 description: 'my super description', 267 name: 'my super name',
266 tags: [ 'supertag1', 'supertag2' ] 268 description: 'my super description',
267 } 269 tags: [ 'supertag1', 'supertag2' ],
268 const { video } = await servers[1].imports.importVideo({ attributes }) 270 thumbnailfile: 'thumbnail.jpg'
271 }
272 })
269 expect(video.name).to.equal('my super name') 273 expect(video.name).to.equal('my super name')
270 }) 274 })
271 275