Base mock of obsidian and global variables window and document

This commit is contained in:
hjonasson 2023-11-17 09:59:50 +13:00
parent edbe4b7958
commit e5b9a58158
No known key found for this signature in database
GPG Key ID: 68D22124ADDEEB04
1 changed files with 22 additions and 0 deletions

22
__mocks__/obsidian.js Normal file
View File

@ -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