aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/helpers/image.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-06-27 11:53:12 +0200
committerChocobozzz <me@florianbigard.com>2022-06-27 11:53:12 +0200
commit3a54605d4e7ec5b4f47131e8d23255be35b7beac (patch)
treefce9d34812a7638d4a0253b076f05aabd15a2ce9 /server/tests/helpers/image.ts
parent88edc66edadcab1b0372679e23bf2a7a6ff50131 (diff)
downloadPeerTube-3a54605d4e7ec5b4f47131e8d23255be35b7beac.tar.gz
PeerTube-3a54605d4e7ec5b4f47131e8d23255be35b7beac.tar.zst
PeerTube-3a54605d4e7ec5b4f47131e8d23255be35b7beac.zip
Process images in a dedicated worker
Diffstat (limited to 'server/tests/helpers/image.ts')
-rw-r--r--server/tests/helpers/image.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/server/tests/helpers/image.ts b/server/tests/helpers/image.ts
index 475ca8fb2..7c5da69b5 100644
--- a/server/tests/helpers/image.ts
+++ b/server/tests/helpers/image.ts
@@ -37,28 +37,28 @@ describe('Image helpers', function () {
37 37
38 it('Should skip processing if the source image is okay', async function () { 38 it('Should skip processing if the source image is okay', async function () {
39 const input = buildAbsoluteFixturePath('thumbnail.jpg') 39 const input = buildAbsoluteFixturePath('thumbnail.jpg')
40 await processImage(input, imageDestJPG, thumbnailSize, true) 40 await processImage({ path: input, destination: imageDestJPG, newSize: thumbnailSize, keepOriginal: true })
41 41
42 await checkBuffers(input, imageDestJPG, true) 42 await checkBuffers(input, imageDestJPG, true)
43 }) 43 })
44 44
45 it('Should not skip processing if the source image does not have the appropriate extension', async function () { 45 it('Should not skip processing if the source image does not have the appropriate extension', async function () {
46 const input = buildAbsoluteFixturePath('thumbnail.png') 46 const input = buildAbsoluteFixturePath('thumbnail.png')
47 await processImage(input, imageDestJPG, thumbnailSize, true) 47 await processImage({ path: input, destination: imageDestJPG, newSize: thumbnailSize, keepOriginal: true })
48 48
49 await checkBuffers(input, imageDestJPG, false) 49 await checkBuffers(input, imageDestJPG, false)
50 }) 50 })
51 51
52 it('Should not skip processing if the source image does not have the appropriate size', async function () { 52 it('Should not skip processing if the source image does not have the appropriate size', async function () {
53 const input = buildAbsoluteFixturePath('preview.jpg') 53 const input = buildAbsoluteFixturePath('preview.jpg')
54 await processImage(input, imageDestJPG, thumbnailSize, true) 54 await processImage({ path: input, destination: imageDestJPG, newSize: thumbnailSize, keepOriginal: true })
55 55
56 await checkBuffers(input, imageDestJPG, false) 56 await checkBuffers(input, imageDestJPG, false)
57 }) 57 })
58 58
59 it('Should not skip processing if the source image does not have the appropriate size', async function () { 59 it('Should not skip processing if the source image does not have the appropriate size', async function () {
60 const input = buildAbsoluteFixturePath('thumbnail-big.jpg') 60 const input = buildAbsoluteFixturePath('thumbnail-big.jpg')
61 await processImage(input, imageDestJPG, thumbnailSize, true) 61 await processImage({ path: input, destination: imageDestJPG, newSize: thumbnailSize, keepOriginal: true })
62 62
63 await checkBuffers(input, imageDestJPG, false) 63 await checkBuffers(input, imageDestJPG, false)
64 }) 64 })
@@ -67,7 +67,7 @@ describe('Image helpers', function () {
67 const input = buildAbsoluteFixturePath('exif.jpg') 67 const input = buildAbsoluteFixturePath('exif.jpg')
68 expect(await hasTitleExif(input)).to.be.true 68 expect(await hasTitleExif(input)).to.be.true
69 69
70 await processImage(input, imageDestJPG, { width: 100, height: 100 }, true) 70 await processImage({ path: input, destination: imageDestJPG, newSize: { width: 100, height: 100 }, keepOriginal: true })
71 await checkBuffers(input, imageDestJPG, false) 71 await checkBuffers(input, imageDestJPG, false)
72 72
73 expect(await hasTitleExif(imageDestJPG)).to.be.false 73 expect(await hasTitleExif(imageDestJPG)).to.be.false
@@ -77,7 +77,7 @@ describe('Image helpers', function () {
77 const input = buildAbsoluteFixturePath('exif.jpg') 77 const input = buildAbsoluteFixturePath('exif.jpg')
78 expect(await hasTitleExif(input)).to.be.true 78 expect(await hasTitleExif(input)).to.be.true
79 79
80 await processImage(input, imageDestJPG, thumbnailSize, true) 80 await processImage({ path: input, destination: imageDestJPG, newSize: thumbnailSize, keepOriginal: true })
81 await checkBuffers(input, imageDestJPG, false) 81 await checkBuffers(input, imageDestJPG, false)
82 82
83 expect(await hasTitleExif(imageDestJPG)).to.be.false 83 expect(await hasTitleExif(imageDestJPG)).to.be.false
@@ -87,7 +87,7 @@ describe('Image helpers', function () {
87 const input = buildAbsoluteFixturePath('exif.png') 87 const input = buildAbsoluteFixturePath('exif.png')
88 expect(await hasTitleExif(input)).to.be.true 88 expect(await hasTitleExif(input)).to.be.true
89 89
90 await processImage(input, imageDestPNG, thumbnailSize, true) 90 await processImage({ path: input, destination: imageDestPNG, newSize: thumbnailSize, keepOriginal: true })
91 expect(await hasTitleExif(imageDestPNG)).to.be.false 91 expect(await hasTitleExif(imageDestPNG)).to.be.false
92 }) 92 })
93 93