decaf-dev_obsidian-vault-ex.../tests/unit/image-utils.test.ts
DecafDev e0f1d64e81
Update cover image system (#283)
* fix: handle loading of external image embeds or embeds without an image extension

* refactor: rename to clear smi cache setting

* fix: don't load image property when cover image source is set to off

* refactor: remove unused fix

* feat: implement new cover image system

* refactor: use correct padding for new lines in settings

* refactor: rename to clear cache data
2024-08-01 00:37:04 -06:00

47 lines
920 B
TypeScript

import { isImageUrl } from "src/svelte/app/services/utils/image-utils";
describe("isImageUrl", () => {
it("should return false for an empty url", () => {
//Arrange
const url = "";
//Act
const result = isImageUrl(url);
//Assert
expect(result).toEqual(false);
});
it("should return false for a url without an extension", () => {
//Arrange
const url = "https://example.com/file";
//Act
const result = isImageUrl(url);
//Assert
expect(result).toEqual(false);
});
it("should return false for a url with an invalid extension", () => {
//Arrange
const url = "https://example.com/file.txt";
//Act
const result = isImageUrl(url);
//Assert
expect(result).toEqual(false);
});
it("should return true for image URLs", () => {
//Arrange
const url = "https://example.com/file.jpg";
//Act
const result = isImageUrl(url);
//Assert
expect(result).toEqual(true);
});
});