dotwee_obsidian-raindropio-.../tests/__mocks__/obsidian.ts
Lukas Wolfsteiner 877b75ddc5 feat: add testing framework and initial test cases
- Introduce Jest as the testing framework and configure it for the project.
- Add initial test cases for block and note parsing functionalities.
- Update ESLint configuration to include test files and adjust global settings.
- Modify package.json to include test scripts and dependencies for Jest.
- Enhance GitHub workflows to run tests during linting and release processes.
2026-05-02 01:33:06 +02:00

35 lines
744 B
TypeScript

import type { CachedMetadata } from "obsidian";
export class Notice {
constructor(public message: string) {}
}
export class Plugin {}
export class PluginSettingTab {}
export class MarkdownView {
file: unknown = null;
}
export class TFile {
path = "";
}
export class ItemView {}
export class Setting {}
export function getAllTags(metadata: CachedMetadata): string[] | null {
const tags = new Set<string>();
for (const tag of metadata.tags ?? []) {
if (tag.tag) tags.add(tag.tag);
}
for (const frontmatterTag of metadata.frontmatter?.tags ?? []) {
if (typeof frontmatterTag === "string") tags.add(frontmatterTag.startsWith("#") ? frontmatterTag : `#${frontmatterTag}`);
}
return tags.size > 0 ? Array.from(tags) : null;
}