mirror of
https://github.com/nathonius/obsidian-github-link.git
synced 2026-07-22 09:20:25 +00:00
🚧 build: Update obsidian dependency and fix test mocks
Update obsidian package to latest for SecretStorage types. Add missing members to test mocks for API compatibility.
This commit is contained in:
parent
ecb86f4009
commit
d9787b89a1
7 changed files with 75 additions and 18 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import type { App, FileManager, Keymap, MetadataCache, Scope, UserEvent, Vault, Workspace } from "obsidian";
|
||||
import type { App, FileManager, Keymap, MetadataCache, RenderContext, Scope, SecretStorage, UserEvent, Vault, Workspace } from "obsidian";
|
||||
|
||||
export class AppMock implements App {
|
||||
get keymap(): Keymap {
|
||||
|
|
@ -22,4 +22,19 @@ export class AppMock implements App {
|
|||
get lastEvent(): UserEvent | null {
|
||||
throw new Error("Not implemented.");
|
||||
}
|
||||
get renderContext(): RenderContext {
|
||||
throw new Error("Not implemented.");
|
||||
}
|
||||
secretStorage: SecretStorage = {
|
||||
setSecret: () => {},
|
||||
getSecret: () => null,
|
||||
listSecrets: () => [],
|
||||
} as unknown as SecretStorage;
|
||||
isDarkMode(): boolean {
|
||||
return false;
|
||||
}
|
||||
loadLocalStorage(key: string): string | null {
|
||||
return null;
|
||||
}
|
||||
saveLocalStorage(key: string, value: string | undefined): void {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,4 +30,13 @@ export class ModalMock implements Modal {
|
|||
onClose(): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
setTitle(title: string): this {
|
||||
return this;
|
||||
}
|
||||
setContent(content: string | DocumentFragment): this {
|
||||
return this;
|
||||
}
|
||||
setCloseCallback(cb: () => void): this {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import type { Notice } from "obsidian";
|
|||
export class NoticeMock implements Notice {
|
||||
constructor(message: string | DocumentFragment, duration?: number | undefined) {}
|
||||
noticeEl!: HTMLElement;
|
||||
containerEl!: HTMLElement;
|
||||
messageEl!: HTMLElement;
|
||||
setMessage(message: string | DocumentFragment): this {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,16 @@ export class PluginMock implements Plugin {
|
|||
registerCodeMirror(callback: (cm: Editor) => any): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
removeCommand(id: string): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
registerBasesView(id: string, factory: any): boolean {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
registerCliHandler(command: string, handler: any): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
onUserEnable(): void {}
|
||||
registerObsidianProtocolHandler(action: string, handler: ObsidianProtocolHandler): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import type { App, PluginSettingTab, Plugin } from "obsidian";
|
||||
|
||||
export class PluginSettingTabMock implements PluginSettingTab {
|
||||
icon: string = "";
|
||||
constructor(
|
||||
public app: App,
|
||||
public plugin: Plugin,
|
||||
|
|
|
|||
49
package-lock.json
generated
49
package-lock.json
generated
|
|
@ -33,7 +33,7 @@
|
|||
"eslint-plugin-unused-imports": "^3.1.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"obsidian": "latest",
|
||||
"obsidian": "^1.12.3",
|
||||
"octokit": "^3.1.2",
|
||||
"prettier": "^3.2.5",
|
||||
"ts-jest": "^29.1.2",
|
||||
|
|
@ -673,18 +673,24 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@codemirror/state": {
|
||||
"version": "6.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.4.0.tgz",
|
||||
"integrity": "sha512-hm8XshYj5Fo30Bb922QX9hXB/bxOAVH+qaqHBzw5TKa72vOeslyGwd4X8M0c1dJ9JqxlaMceOQ8RsL9tC7gU0A==",
|
||||
"dev": true
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.5.0.tgz",
|
||||
"integrity": "sha512-MwBHVK60IiIHDcoMet78lxt6iw5gJOGSbNbOIVBHWVXIH4/Nq1+GQgLLGgI1KlnN86WDXsPudVaqYHKBIx7Eyw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@marijn/find-cluster-break": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/view": {
|
||||
"version": "6.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.23.0.tgz",
|
||||
"integrity": "sha512-/51px9N4uW8NpuWkyUX+iam5+PM6io2fm+QmRnzwqBy5v/pwGg9T0kILFtYeum8hjuvENtgsGNKluOfqIICmeQ==",
|
||||
"version": "6.38.6",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.38.6.tgz",
|
||||
"integrity": "sha512-qiS0z1bKs5WOvHIAC0Cybmv4AJSkAXgX5aD6Mqd2epSLlVJsQl8NG23jCVouIgkh4All/mrbdsf2UOLFnJw0tw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/state": "^6.4.0",
|
||||
"@codemirror/state": "^6.5.0",
|
||||
"crelt": "^1.0.6",
|
||||
"style-mod": "^4.1.0",
|
||||
"w3c-keyname": "^2.2.4"
|
||||
}
|
||||
|
|
@ -1648,6 +1654,13 @@
|
|||
"@lezer/common": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@marijn/find-cluster-break": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz",
|
||||
"integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
|
|
@ -3190,6 +3203,13 @@
|
|||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/crelt": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz",
|
||||
"integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
|
|
@ -6398,17 +6418,18 @@
|
|||
}
|
||||
},
|
||||
"node_modules/obsidian": {
|
||||
"version": "1.4.11",
|
||||
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.4.11.tgz",
|
||||
"integrity": "sha512-BCVYTvaXxElJMl6MMbDdY/CGK+aq18SdtDY/7vH8v6BxCBQ6KF4kKxL0vG9UZ0o5qh139KpUoJHNm+6O5dllKA==",
|
||||
"version": "1.12.3",
|
||||
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.12.3.tgz",
|
||||
"integrity": "sha512-HxWqe763dOqzXjnNiHmAJTRERN8KILBSqxDSEqbeSr7W8R8Jxezzbca+nz1LiiqXnMpM8lV2jzAezw3CZ4xNUw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/codemirror": "5.60.8",
|
||||
"moment": "2.29.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.0.0"
|
||||
"@codemirror/state": "6.5.0",
|
||||
"@codemirror/view": "6.38.6"
|
||||
}
|
||||
},
|
||||
"node_modules/obsidian/node_modules/moment": {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
"eslint-plugin-unused-imports": "^3.1.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"obsidian": "latest",
|
||||
"obsidian": "^1.12.3",
|
||||
"octokit": "^3.1.2",
|
||||
"prettier": "^3.2.5",
|
||||
"ts-jest": "^29.1.2",
|
||||
|
|
@ -49,4 +49,4 @@
|
|||
"lodash": "^4.17.21",
|
||||
"queue": "^7.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue