mirror of
https://github.com/decaf-dev/obsidian-vault-explorer.git
synced 2026-07-22 10:10:31 +00:00
* 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
47 lines
920 B
TypeScript
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);
|
|
});
|
|
});
|