mirror of
https://github.com/dotwee/obsidian-raindropio-plugin.git
synced 2026-07-22 06:50:29 +00:00
Set compile and bundle target to ES2021 since Obsidian runs on modern Electron. Replace individual strict flags with strict: true and add noFallthroughCasesInSwitch, skipLibCheck and forceConsistentCasingInFileNames. Switch module resolution to bundler, removing the need for deprecation workarounds on TypeScript 6. Drop baseUrl, allowJs and importHelpers; tests now import sources via relative paths. Aligns the project with the modernized obsidian-sample-plugin configuration. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
829 B
TypeScript
25 lines
829 B
TypeScript
import type { CachedMetadata } from "obsidian";
|
|
import { buildNoteRaindropSearch } from "../src/note-search";
|
|
|
|
describe("buildNoteRaindropSearch", () => {
|
|
it("builds an OR query from note tags and urls", () => {
|
|
const metadata: CachedMetadata = {
|
|
tags: [{ tag: "#docs", position: { start: { line: 0, col: 0, offset: 0 }, end: { line: 0, col: 5, offset: 5 } } }],
|
|
};
|
|
const source = "See [the docs](https://example.com/docs?ref=\"plugin\").";
|
|
|
|
expect(buildNoteRaindropSearch(source, metadata)).toEqual({
|
|
query: '#docs "https://example.com/docs?ref=\\"plugin\\"" match:OR',
|
|
urlCount: 1,
|
|
tagCount: 1,
|
|
});
|
|
});
|
|
|
|
it("returns an empty query for notes without references", () => {
|
|
expect(buildNoteRaindropSearch("Nothing to search", null)).toEqual({
|
|
query: "",
|
|
urlCount: 0,
|
|
tagCount: 0,
|
|
});
|
|
});
|
|
});
|