Start with highest quality compression and find a suitable size (#33)

This commit is contained in:
Paul Frazee 2022-12-26 12:01:40 -06:00 committed by GitHub
parent 8652b74a38
commit 838fc601c1
7 changed files with 108 additions and 48 deletions

View file

@ -1,4 +1,4 @@
import {downloadAndResize, DownloadAndResizeOpts} from '../../src/lib/download'
import {downloadAndResize, DownloadAndResizeOpts} from '../../src/lib/images'
import ImageResizer from '@bam.tech/react-native-image-resizer'
import RNFetchBlob from 'rn-fetch-blob'
@ -16,6 +16,7 @@ describe('downloadAndResize', () => {
const mockResizedImage = {
path: jest.fn().mockReturnValue('file://resized-image.jpg'),
size: 100,
}
beforeEach(() => {
@ -37,6 +38,7 @@ describe('downloadAndResize', () => {
uri: 'https://example.com/image.jpg',
width: 100,
height: 100,
maxSize: 500000,
mode: 'cover',
timeout: 10000,
}
@ -56,7 +58,7 @@ describe('downloadAndResize', () => {
100,
100,
'JPEG',
0.7,
1,
undefined,
undefined,
undefined,
@ -69,6 +71,7 @@ describe('downloadAndResize', () => {
uri: 'invalid-uri',
width: 100,
height: 100,
maxSize: 500000,
mode: 'cover',
timeout: 10000,
}
@ -83,6 +86,7 @@ describe('downloadAndResize', () => {
uri: 'https://example.com/image.bmp',
width: 100,
height: 100,
maxSize: 500000,
mode: 'cover',
timeout: 10000,
}