Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions __mocks__/obsidian.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export class Component {
private _cleanups: (() => any)[] = [];
load() { this.onload(); }
onload() {}
unload() { this._cleanups.forEach(cb => cb()); this.onunload(); }
onunload() {}
register(cb: () => any) { this._cleanups.push(cb); }
addChild<T extends Component>(c: T) { return c; }
removeChild<T extends Component>(c: T) { return c; }
}

export class MarkdownRenderChild extends Component {
containerEl: HTMLElement;
constructor(containerEl: HTMLElement) {
super();
this.containerEl = containerEl;
}
}

export class App {}
export class Plugin extends Component {}
export class TFile {}
1 change: 1 addition & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default {
extensionsToTreatAsEsm: ['.ts'],
setupFilesAfterEnv: ['<rootDir>/jest.setup.mjs'],
moduleNameMapper: {
'^obsidian$': '<rootDir>/__mocks__/obsidian.ts',
'^virtual:wa-sqlite-wasm-url$': '<rootDir>/src/modules/explorer/database/__tests__/__mocks__/wa-sqlite-wasm-url.ts',
'^(\\.{1,2}/.*)\\.js$': '$1',
},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"esbuild-plugin-replace": "^1.4.0",
"esbuild-sass-plugin": "^3.3.1",
"jest": "^30.0.5",
"jest-environment-jsdom": "^30.3.0",
"obsidian": "^1.8.7",
"prettier": "3.6.2",
"ts-jest": "^29.4.1",
Expand Down
Loading
Loading