super-productivity/packages/plugin-dev/sync-md/src/setupTests.ts
Johannes Millan e4f83e3de8 feat(syncMd): add comprehensive test suite and development configuration
Tests:
- Markdown parser tests with edge cases and error handling
- Task operations generator tests for create/update/delete/reorder
- SP to markdown conversion tests with ordering validation
- Sync state verification tests
- Integration tests for full sync workflows
- File utilities tests

Configuration:
- Jest setup for plugin testing
- ESLint and Prettier configuration
- Test utilities and mocks
2025-07-10 14:56:19 +02:00

39 lines
958 B
TypeScript

// Jest setup file
import { PluginAPI } from '@super-productivity/plugin-api';
// Create a mock PluginAPI
const mockPluginAPI: PluginAPI = {
getTasks: jest.fn(async () => []),
getAllProjects: jest.fn(async () => []),
getProjects: jest.fn(() => []),
onTasksUpdated$: {
subscribe: jest.fn(),
},
onProjectsUpdated$: {
subscribe: jest.fn(),
},
batchActions: jest.fn(),
executeNodeScript: jest.fn(async () => ({
success: true,
result: { success: true },
})),
loadSyncedData: jest.fn(async () => null),
persistDataSynced: jest.fn(async () => {}),
onMessage: jest.fn(),
ui: {
sendCommand: jest.fn(),
onCommand$: {
subscribe: jest.fn(),
},
},
log: jest.fn(),
showSnack: jest.fn(),
updateTask: jest.fn(),
addTask: jest.fn(),
deleteTask: jest.fn(),
getProject: jest.fn(),
triggerAction: jest.fn(),
} as unknown as PluginAPI;
// Assign to global
(global as any).PluginAPI = mockPluginAPI;