andy-stack_vaultkeeper-ai/__tests__/setup.ts
Andrew Beal 0851e81d7b refactor: replace direct DOM manipulation with HTMLService
Introduces HTMLService to centralize HTML/DOM operations and updates
SearchTrigger, StreamingMarkdownService, and tests to use the new
service instead of directly manipulating innerHTML and DOM methods.
2025-11-01 13:27:53 +00:00

24 lines
505 B
TypeScript

/**
* Test setup file - runs before all tests
*/
import { afterEach, vi } from 'vitest';
// Mock global window if needed
if (typeof global.window === 'undefined') {
global.window = {} as any;
}
// Add Obsidian's .empty() method to HTMLElement prototype for testing
if (typeof HTMLElement !== 'undefined') {
HTMLElement.prototype.empty = function() {
while (this.firstChild) {
this.removeChild(this.firstChild);
}
};
}
// Clean up after each test
afterEach(() => {
vi.clearAllMocks();
});