minor tweak tests
This commit is contained in:
parent
e8aab76148
commit
ea20167981
|
@ -1,26 +1,31 @@
|
||||||
import { isImage } from './image';
|
import { isImage } from './image';
|
||||||
|
|
||||||
const imageJPG = 'https://i.redd.it/t2mul61342l91.jpg';
|
const imageJPG = 't2mul61342l91.jpg';
|
||||||
const imagePNG = 'https://user-images.githubusercontent.com/47038980/205175493-fc1f7fdd-d10a-4099-88c4-146bac69e223.png';
|
const imagePNG = '205175493-fc1f7fdd-d10a-4099-88c4-146bac69e223.png';
|
||||||
const imageSVG = 'https://i.redd.it/t2mul61342l91.svg';
|
const imageSVG = 't2mul61342l91.svg';
|
||||||
const imageUrlWithQueryParams =
|
const linkToImagePNG = 'https://user-images.githubusercontent.com/47038980/205175493-fc1f7fdd-d10a-4099-88c4-146bac69e223.png';
|
||||||
|
const linkToImageWithQueryParams =
|
||||||
'https://i.ytimg.com/vi/suFuJZCfC7g/hqdefault.jpg?sqp=-oaymwE2CNACELwBSFXyq4qpAygIARUAAIhCGAFwAcABBvABAfgB_gmAAtAFigIMCAAQARhlIGUoZTAP&rs=AOn4CLB_0OCFNuoCRBlaTJEa2PPOOHxkbQ';
|
'https://i.ytimg.com/vi/suFuJZCfC7g/hqdefault.jpg?sqp=-oaymwE2CNACELwBSFXyq4qpAygIARUAAIhCGAFwAcABBvABAfgB_gmAAtAFigIMCAAQARhlIGUoZTAP&rs=AOn4CLB_0OCFNuoCRBlaTJEa2PPOOHxkbQ';
|
||||||
|
|
||||||
describe("Evaluate if the link is returning an image's type", () => {
|
describe("Evaluate if the string is returning an image's type", () => {
|
||||||
test('return true when the link ends with .jpg', () => {
|
test('return true when the image ends with .jpg', () => {
|
||||||
const result = isImage(imageJPG);
|
const result = isImage(imageJPG);
|
||||||
expect(result).toBe(true);
|
expect(result).toBe(true);
|
||||||
});
|
});
|
||||||
test('return true when the link ends with .png', () => {
|
test('return true when the image ends with .png', () => {
|
||||||
const result = isImage(imagePNG);
|
const result = isImage(imagePNG);
|
||||||
expect(result).toBe(true);
|
expect(result).toBe(true);
|
||||||
});
|
});
|
||||||
test('return false when the link ends with .svg', () => {
|
test('return false when the image ends with .svg', () => {
|
||||||
const result = isImage(imageSVG);
|
const result = isImage(imageSVG);
|
||||||
expect(result).toBe(false);
|
expect(result).toBe(false);
|
||||||
});
|
});
|
||||||
test('return true when the link ends with .jpg and query params', () => {
|
test('return true when the image ends with .jpg and query params', () => {
|
||||||
const result = isImage(imageUrlWithQueryParams);
|
const result = isImage(linkToImageWithQueryParams);
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
test('return true when a link ends with .png', () => {
|
||||||
|
const result = isImage(linkToImagePNG);
|
||||||
expect(result).toBe(true);
|
expect(result).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue