Skip to content

Commit 554d9f5

Browse files
committed
GetCldOgImageUrl Tests
1 parent ae4cb05 commit 554d9f5

File tree

3 files changed

+4081
-3285
lines changed

3 files changed

+4081
-3285
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { render, screen, cleanup } from '@testing-library/svelte';
2+
import { afterEach, describe, expect, it, vi } from 'vitest';
3+
import { CldImage, getCldOgImageUrl } from '$src/index';
4+
import { tick } from 'svelte';
5+
6+
describe('getCldOgImageUrl', () => {
7+
afterEach(() => {
8+
cleanup();
9+
});
10+
11+
it('should render a Cloudinary image with the given attributes', () => {
12+
const url = getCldOgImageUrl({
13+
src: 'images/turtle.jpeg',
14+
})
15+
console.log(url)
16+
render(CldImage, {
17+
props: {
18+
src: 'turtle',
19+
alt: 'turtle image',
20+
width: 500,
21+
height: 300,
22+
},
23+
});
24+
25+
const img: HTMLImageElement = screen.getByRole('img');
26+
27+
expect(img.src).toContain('https://res.cloudinary.com');
28+
expect(img.src).toContain('w_300');
29+
expect(img.src).toContain('h_200');
30+
});
31+
});
8.63 KB
Loading

0 commit comments

Comments
 (0)