From e5b9a58158e18a081949e2ce3f7c843842f48f2c Mon Sep 17 00:00:00 2001 From: hjonasson Date: Fri, 17 Nov 2023 09:59:50 +1300 Subject: [PATCH] Base mock of obsidian and global variables window and document --- __mocks__/obsidian.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 __mocks__/obsidian.js diff --git a/__mocks__/obsidian.js b/__mocks__/obsidian.js new file mode 100644 index 0000000..ddd82b7 --- /dev/null +++ b/__mocks__/obsidian.js @@ -0,0 +1,22 @@ +module.exports = { + Vault: {}, + Workspace: {}, + Plugin: class { + addCommand() { } + addRibbonIcon() { } + addSettingTab() { } + addStatusBarItem() { return { setText: () => { } }; } + loadData() { } + registerDomEvent() { } + registerInterval() { } + }, + Modal: class { }, + PluginSettingTab: class { }, + TFolder: class { }, +}; + +// eslint-disable-next-line @typescript-eslint/no-var-requires +const JSDOM = require("jsdom").JSDOM +const dom = new JSDOM() +global.document = dom.window.document +global.window = dom.window \ No newline at end of file