mirror of
https://github.com/BradNut/weddingsite
synced 2025-09-08 17:40:36 +00:00
23 lines
853 B
JavaScript
23 lines
853 B
JavaScript
|
|
import buildBase64Data from '../utils/buildBase64Data';
|
||
|
|
|
||
|
|
describe('build base 64 function', () => {
|
||
|
|
const imageName = 'https://picsum.photos/1307/880';
|
||
|
|
const alt = 'test alt';
|
||
|
|
it('takes an image name and builds base64 image', async () => {
|
||
|
|
const imageData = await buildBase64Data(false, imageName, alt, {});
|
||
|
|
expect(imageData).toBeDefined();
|
||
|
|
expect(imageData.alt).toEqual(alt);
|
||
|
|
expect(imageData.imageProps).toBeDefined();
|
||
|
|
expect(imageData.imageProps.blurDataURL).toContain(
|
||
|
|
'data:image/jpeg;base64'
|
||
|
|
);
|
||
|
|
expect(imageData.imageProps.height).toBeGreaterThan(0);
|
||
|
|
expect(imageData.imageProps.width).toBeGreaterThan(0);
|
||
|
|
expect(imageData.imageProps.src).toContain(imageName);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('fails if image not resolved', async () => {
|
||
|
|
expect(await buildBase64Data(false, 'Blah', alt, {})).toEqual({});
|
||
|
|
});
|
||
|
|
});
|