slopus--happy
98e40dac97
CLI Smoke Test / smoke-test-linux (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-linux (24) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (24) (push) Has been cancelled
Expo App TypeScript typecheck / typecheck (push) Has been cancelled
25 行
745 B
TypeScript
25 行
745 B
TypeScript
import { processImage } from './processImage';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
describe('processImage', () => {
|
|
it('should resize image', async () => {
|
|
const sharp = (await import('sharp')).default;
|
|
const img = await sharp({
|
|
create: {
|
|
width: 200,
|
|
height: 100,
|
|
channels: 3,
|
|
background: '#ff0000',
|
|
},
|
|
}).jpeg().toBuffer();
|
|
|
|
const result = await processImage(img);
|
|
|
|
expect(result.format).toBe('jpeg');
|
|
expect(result.width).toBe(200);
|
|
expect(result.height).toBe(100);
|
|
expect(result.thumbhash).toBeTruthy();
|
|
expect(result.pixels).toHaveLength(100 * 50 * 4);
|
|
});
|
|
});
|